]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/Ia32/CpuId.c
1. Remove #ifdef _MSC_EXTENSION_ from all source files
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / CpuId.c
1 /** @file
2 AsmCpuid function.
3
4 Copyright (c) 2006 - 2007, 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 UINT32
16 EFIAPI
17 AsmCpuid (
18 IN UINT32 Index,
19 OUT UINT32 *RegisterEax, OPTIONAL
20 OUT UINT32 *RegisterEbx, OPTIONAL
21 OUT UINT32 *RegisterEcx, OPTIONAL
22 OUT UINT32 *RegisterEdx OPTIONAL
23 )
24 {
25 _asm {
26 mov eax, Index
27 cpuid
28 push ecx
29 mov ecx, RegisterEax
30 jecxz SkipEax
31 mov [ecx], eax
32 SkipEax:
33 mov ecx, RegisterEbx
34 jecxz SkipEbx
35 mov [ecx], ebx
36 SkipEbx:
37 pop eax
38 mov ecx, RegisterEcx
39 jecxz SkipEcx
40 mov [ecx], eax
41 SkipEcx:
42 mov ecx, RegisterEdx
43 jecxz SkipEdx
44 mov [ecx], edx
45 SkipEdx:
46 mov eax, Index
47 }
48 }
49