1. Added AsmCpuidEx() to BaseLib
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / CpuIdEx.asm
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
24 .686
25 .model flat,C
26 .code
27
28 ;------------------------------------------------------------------------------
29 ; UINT32
30 ; EFIAPI
31 ; AsmCpuidEx (
32 ; IN UINT32 RegisterInEax,
33 ; IN UINT32 RegisterInEcx,
34 ; OUT UINT32 *RegisterOutEax OPTIONAL,
35 ; OUT UINT32 *RegisterOutEbx OPTIONAL,
36 ; OUT UINT32 *RegisterOutEcx OPTIONAL,
37 ; OUT UINT32 *RegisterOutEdx OPTIONAL
38 ; )
39 ;------------------------------------------------------------------------------
40 AsmCpuidEx PROC USES ebx
41 push ebp
42 mov ebp, esp
43 mov eax, [ebp + 12]
44 mov ecx, [ebp + 16]
45 cpuid
46 push ecx
47 mov ecx, [ebp + 20]
48 jecxz @F
49 mov [ecx], eax
50 @@:
51 mov ecx, [ebp + 24]
52 jecxz @F
53 mov [ecx], ebx
54 @@:
55 mov ecx, [ebp + 28]
56 jecxz @F
57 pop [ecx]
58 @@:
59 mov edx, [ebp + 32]
60 jecxz @F
61 mov [ecx], edx
62 @@:
63 mov eax, [ebp + 12]
64 leave
65 ret
66 AsmCpuidEx ENDP
67
68 END