1#------------------------------------------------------------------------------
2#
3# Copyright (c) 2006 - 2012, 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.S
15#
16# Abstract:
17#
18#   AsmCpuidEx function
19#
20# Notes:
21#
22#------------------------------------------------------------------------------
23
24
25    .code:
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#------------------------------------------------------------------------------
39ASM_GLOBAL ASM_PFX(AsmCpuidEx)
40ASM_PFX(AsmCpuidEx):
41    push    %ebx
42    push    %ebp
43    movl    %esp, %ebp
44    movl    12(%ebp), %eax
45    movl    16(%ebp), %ecx
46    cpuid
47    push    %ecx
48    movl    20(%ebp), %ecx
49    jecxz   L1
50    movl    %eax, (%ecx)
51L1:
52    movl    24(%ebp), %ecx
53    jecxz   L2
54    movl    %ebx, (%ecx)
55L2:
56    movl    32(%ebp), %ecx
57    jecxz   L3
58    movl    %edx, (%ecx)
59L3:
60    movl    28(%ebp), %ecx
61    jecxz   L4
62    popl    (%ecx)
63L4:
64    movl    12(%ebp), %eax
65    leave
66    pop     %ebx
67    ret
68