]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/Ia32/Mwait.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / Mwait.c
CommitLineData
e1f414b6 1/** @file\r
2 AsmMwait function\r
3\r
bb817c56 4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
9344f092 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
e1f414b6 6\r
7**/\r
8\r
42eedea9 9/**\r
10 Executes an MWAIT instruction.\r
11\r
12 Executes an MWAIT instruction with the register state specified by Eax and\r
030cd1a2 13 Ecx. Returns Eax. This function is only available on IA-32 and x64.\r
42eedea9 14\r
44b013bd 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
42eedea9 19\r
44b013bd 20 @return RegisterEax\r
42eedea9 21\r
22**/\r
e1f414b6 23UINTN\r
24EFIAPI\r
25AsmMwait (\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
38\r