]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/BaseLib/Ia32/CpuIdEx.c
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Library / BaseLib / Ia32 / CpuIdEx.c
... / ...
CommitLineData
1/** @file\r
2 AsmCpuidEx function.\r
3\r
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15/**\r
16 Retrieves CPUID information using an extended leaf identifier.\r
17\r
18 Executes the CPUID instruction with EAX set to the value specified by Index\r
19 and ECX set to the value specified by SubIndex. This function always returns\r
20 Index. This function is only available on IA-32 and x64.\r
21\r
22 If Eax is not NULL, then the value of EAX after CPUID is returned in Eax.\r
23 If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx.\r
24 If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx.\r
25 If Edx is not NULL, then the value of EDX after CPUID is returned in Edx.\r
26\r
27 @param Index The 32-bit value to load into EAX prior to invoking the\r
28 CPUID instruction.\r
29 @param SubIndex The 32-bit value to load into ECX prior to invoking the\r
30 CPUID instruction.\r
31 @param RegisterEax Pointer to the 32-bit EAX value returned by the CPUID\r
32 instruction. This is an optional parameter that may be\r
33 NULL.\r
34 @param RegisterEbx Pointer to the 32-bit EBX value returned by the CPUID\r
35 instruction. This is an optional parameter that may be\r
36 NULL.\r
37 @param RegisterEcx Pointer to the 32-bit ECX value returned by the CPUID\r
38 instruction. This is an optional parameter that may be\r
39 NULL.\r
40 @param RegisterEdx Pointer to the 32-bit EDX value returned by the CPUID\r
41 instruction. This is an optional parameter that may be\r
42 NULL.\r
43\r
44 @return Index.\r
45\r
46**/\r
47UINT32\r
48EFIAPI\r
49AsmCpuidEx (\r
50 IN UINT32 Index,\r
51 IN UINT32 SubIndex,\r
52 OUT UINT32 *RegisterEax, OPTIONAL\r
53 OUT UINT32 *RegisterEbx, OPTIONAL\r
54 OUT UINT32 *RegisterEcx, OPTIONAL\r
55 OUT UINT32 *RegisterEdx OPTIONAL\r
56 )\r
57{\r
58 _asm {\r
59 mov eax, Index\r
60 mov ecx, SubIndex\r
61 cpuid\r
62 push ecx\r
63 mov ecx, RegisterEax\r
64 jecxz SkipEax\r
65 mov [ecx], eax\r
66SkipEax:\r
67 mov ecx, RegisterEbx\r
68 jecxz SkipEbx\r
69 mov [ecx], ebx\r
70SkipEbx:\r
71 pop eax\r
72 mov ecx, RegisterEcx\r
73 jecxz SkipEcx\r
74 mov [ecx], eax\r
75SkipEcx:\r
76 mov ecx, RegisterEdx\r
77 jecxz SkipEdx\r
78 mov [ecx], edx\r
79SkipEdx:\r
80 mov eax, Index\r
81 }\r
82}\r