]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | AsmMwait function\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
6 | \r | |
7 | **/\r | |
8 | \r | |
9 | /**\r | |
10 | Executes an MWAIT instruction.\r | |
11 | \r | |
12 | Executes an MWAIT instruction with the register state specified by Eax and\r | |
13 | Ecx. Returns Eax. This function is only available on IA-32 and x64.\r | |
14 | \r | |
15 | @param RegisterEax The value to load into EAX or RAX before executing the MONITOR\r | |
16 | instruction.\r | |
17 | @param RegisterEcx The value to load into ECX or RCX before executing the MONITOR\r | |
18 | instruction.\r | |
19 | \r | |
20 | @return RegisterEax\r | |
21 | \r | |
22 | **/\r | |
23 | UINTN\r | |
24 | EFIAPI\r | |
25 | AsmMwait (\r | |
26 | IN UINTN RegisterEax,\r | |
27 | IN UINTN RegisterEcx\r | |
28 | )\r | |
29 | {\r | |
30 | _asm {\r | |
31 | mov eax, RegisterEax\r | |
32 | mov ecx, RegisterEcx\r | |
33 | _emit 0x0f // mwait\r | |
34 | _emit 0x01\r | |
35 | _emit 0xC9\r | |
36 | }\r | |
37 | }\r |