1;------------------------------------------------------------------------------
2;
3; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4; 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
24    DEFAULT REL
25    SECTION .text
26
27;------------------------------------------------------------------------------
28;  UINT32
29;  EFIAPI
30;  AsmCpuidEx (
31;    IN   UINT32  RegisterInEax,
32;    IN   UINT32  RegisterInEcx,
33;    OUT  UINT32  *RegisterOutEax  OPTIONAL,
34;    OUT  UINT32  *RegisterOutEbx  OPTIONAL,
35;    OUT  UINT32  *RegisterOutEcx  OPTIONAL,
36;    OUT  UINT32  *RegisterOutEdx  OPTIONAL
37;    )
38;------------------------------------------------------------------------------
39global ASM_PFX(AsmCpuidEx)
40ASM_PFX(AsmCpuidEx):
41    push    rbx
42    mov     eax, ecx
43    mov     ecx, edx
44    push    rax                         ; save Index on stack
45    cpuid
46    mov     r10, [rsp + 0x38]
47    test    r10, r10
48    jz      .0
49    mov     [r10], ecx
50.0:
51    mov     rcx, r8
52    jrcxz   .1
53    mov     [rcx], eax
54.1:
55    mov     rcx, r9
56    jrcxz   .2
57    mov     [rcx], ebx
58.2:
59    mov     rcx, [rsp + 0x40]
60    jrcxz   .3
61    mov     [rcx], edx
62.3:
63    pop     rax                         ; restore Index to rax as return value
64    pop     rbx
65    ret
66
67