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