]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/X64/CpuId.asm
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseLib / X64 / CpuId.asm
CommitLineData
3eb9473e 1; Copyright (c) 2004, Intel Corporation \r
2; All rights reserved. This program and the accompanying materials \r
3; are licensed and made available under the terms and conditions of the BSD License \r
4; which accompanies this distribution. The full text of the license may be found at \r
5; http://opensource.org/licenses/bsd-license.php \r
6; \r
7; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
8; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
9;\r
10; Module Name:\r
11;\r
12; CpuId.Asm\r
13;\r
14; Abstract:\r
15;\r
16; AsmCpuid function\r
17;\r
18; Notes:\r
19;\r
20;------------------------------------------------------------------------------\r
21\r
22 .code\r
23\r
24;------------------------------------------------------------------------------\r
25; VOID\r
26; EFIAPI\r
27; AsmCpuid (\r
28; IN UINT32 RegisterInEax,\r
29; OUT UINT32 *RegisterOutEax OPTIONAL,\r
30; OUT UINT32 *RegisterOutEbx OPTIONAL,\r
31; OUT UINT32 *RegisterOutEcx OPTIONAL,\r
32; OUT UINT32 *RegisterOutEdx OPTIONAL\r
33; )\r
34;------------------------------------------------------------------------------\r
35AsmCpuid PROC USES rbx\r
36 mov eax, ecx\r
37 push rax ; save Index on stack\r
38 push rdx\r
39 cpuid\r
40 test r9, r9\r
41 jz @F\r
42 mov [r9], ecx\r
43@@:\r
44 pop rcx\r
45 jrcxz @F\r
46 mov [rcx], eax\r
47@@:\r
48 mov rcx, r8\r
49 jrcxz @F\r
50 mov [rcx], ebx\r
51@@:\r
52 mov rcx, [rsp + 38h]\r
53 jrcxz @F\r
54 mov [rcx], edx\r
55@@:\r
56 pop rax ; restore Index to rax as return value\r
57 ret\r
58AsmCpuid ENDP\r
59\r
60 END\r