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