Initial import.
[mirror_edk2.git] / MdePkg / Library / BaseLib / ia32 / CpuId.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 ; CpuId.Asm
15 ;
16 ; Abstract:
17 ;
18 ; AsmCpuid function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .586P
25 .model flat,C
26 .code
27
28 ;------------------------------------------------------------------------------
29 ; VOID
30 ; EFIAPI
31 ; AsmCpuid (
32 ; IN UINT32 RegisterInEax,
33 ; OUT UINT32 *RegisterOutEax OPTIONAL,
34 ; OUT UINT32 *RegisterOutEbx OPTIONAL,
35 ; OUT UINT32 *RegisterOutEcx OPTIONAL,
36 ; OUT UINT32 *RegisterOutEdx OPTIONAL
37 ; )
38 ;------------------------------------------------------------------------------
39 AsmCpuid PROC USES ebx
40 push ebp
41 mov ebp, esp
42 mov eax, [ebp + 12]
43 cpuid
44 push ecx
45 mov ecx, [ebp + 16]
46 jecxz @F
47 mov [ecx], eax
48 @@:
49 mov ecx, [ebp + 20]
50 jecxz @F
51 mov [ecx], ebx
52 @@:
53 mov ecx, [ebp + 24]
54 jecxz @F
55 pop [ecx]
56 @@:
57 mov ecx, [ebp + 28]
58 jecxz @F
59 mov [ecx], edx
60 @@:
61 mov eax, [ebp + 12]
62 leave
63 ret
64 AsmCpuid ENDP
65
66 END