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