]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/Monitor.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / Monitor.c
1 /** @file
2 AsmMonitor 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 Sets up a monitor buffer that is used by AsmMwait().
11
12 Executes a MONITOR instruction with the register state specified by Eax, Ecx
13 and Edx. 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 @param RegisterEdx The value to load into EDX or RDX before executing the MONITOR
20 instruction.
21
22 @return RegisterEax
23
24 **/
25 UINTN
26 EFIAPI
27 AsmMonitor (
28 IN UINTN RegisterEax,
29 IN UINTN RegisterEcx,
30 IN UINTN RegisterEdx
31 )
32 {
33 _asm {
34 mov eax, RegisterEax
35 mov ecx, RegisterEcx
36 mov edx, RegisterEdx
37 _emit 0x0f // monitor
38 _emit 0x01
39 _emit 0xc8
40 }
41 }
42