]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/Ia32/Monitor.c
MdePkg/BaseLib: Support IA32 processors without CLFLUSH
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / Monitor.c
CommitLineData
e1f414b6 1/** @file\r
2 AsmMonitor function\r
3\r
bb817c56
HT
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
e1f414b6 6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
e4a34497 8 http://opensource.org/licenses/bsd-license.php.\r
e1f414b6 9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
42eedea9 15/**\r
16 Sets up a monitor buffer that is used by AsmMwait().\r
17\r
18 Executes a MONITOR instruction with the register state specified by Eax, Ecx\r
030cd1a2 19 and Edx. Returns Eax. This function is only available on IA-32 and x64.\r
42eedea9 20\r
44b013bd 21 @param RegisterEax The value to load into EAX or RAX before executing the MONITOR\r
22 instruction.\r
23 @param RegisterEcx The value to load into ECX or RCX before executing the MONITOR\r
24 instruction.\r
25 @param RegisterEdx The value to load into EDX or RDX before executing the MONITOR\r
26 instruction.\r
42eedea9 27\r
44b013bd 28 @return RegisterEax\r
42eedea9 29\r
30**/\r
e1f414b6 31UINTN\r
32EFIAPI\r
33AsmMonitor (\r
34 IN UINTN RegisterEax,\r
35 IN UINTN RegisterEcx,\r
36 IN UINTN RegisterEdx\r
37 )\r
38{\r
39 _asm {\r
40 mov eax, RegisterEax\r
41 mov ecx, RegisterEcx\r
42 mov edx, RegisterEdx\r
43 _emit 0x0f // monitor\r
44 _emit 0x01\r
45 _emit 0xc8\r
46 }\r
47}\r
48\r