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