]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
6ebbcbcf109552c00e7fd59a84b042e552351499
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / CpuIdEx.c
1 /** @file
2 AsmCpuidEx function.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #if _MSC_EXTENSIONS
16
17 UINT32
18 EFIAPI
19 AsmCpuidEx (
20 IN UINT32 Index,
21 IN UINT32 SubIndex,
22 OUT UINT32 *RegisterEax, OPTIONAL
23 OUT UINT32 *RegisterEbx, OPTIONAL
24 OUT UINT32 *RegisterEcx, OPTIONAL
25 OUT UINT32 *RegisterEdx OPTIONAL
26 )
27 {
28 _asm {
29 mov eax, Index
30 mov ecx, SubIndex
31 cpuid
32 push ecx
33 mov ecx, RegisterEax
34 jecxz SkipEax
35 mov [ecx], eax
36 SkipEax:
37 mov ecx, RegisterEbx
38 jecxz SkipEbx
39 mov [ecx], ebx
40 SkipEbx:
41 pop eax
42 mov ecx, RegisterEcx
43 jecxz SkipEcx
44 mov [ecx], eax
45 SkipEcx:
46 mov ecx, RegisterEdx
47 jecxz SkipEdx
48 mov [ecx], edx
49 SkipEdx:
50 mov eax, Index
51 }
52 }
53
54 #endif