]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseLib/X64/CpuId.nasm
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseLib / X64 / CpuId.nasm
CommitLineData
fd5eb53d
JJ
1;------------------------------------------------------------------------------\r
2;\r
3; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
9344f092 4; SPDX-License-Identifier: BSD-2-Clause-Patent\r
fd5eb53d
JJ
5;\r
6; Module Name:\r
7;\r
8; CpuId.Asm\r
9;\r
10; Abstract:\r
11;\r
12; AsmCpuid function\r
13;\r
14; Notes:\r
15;\r
16;------------------------------------------------------------------------------\r
17\r
18 DEFAULT REL\r
19 SECTION .text\r
20\r
21;------------------------------------------------------------------------------\r
22; VOID\r
23; EFIAPI\r
24; AsmCpuid (\r
25; IN UINT32 RegisterInEax,\r
26; OUT UINT32 *RegisterOutEax OPTIONAL,\r
27; OUT UINT32 *RegisterOutEbx OPTIONAL,\r
28; OUT UINT32 *RegisterOutEcx OPTIONAL,\r
29; OUT UINT32 *RegisterOutEdx OPTIONAL\r
30; )\r
31;------------------------------------------------------------------------------\r
32global ASM_PFX(AsmCpuid)\r
33ASM_PFX(AsmCpuid):\r
34 push rbx\r
35 mov eax, ecx\r
36 push rax ; save Index on stack\r
37 push rdx\r
38 cpuid\r
39 test r9, r9\r
40 jz .0\r
41 mov [r9], ecx\r
42.0:\r
43 pop rcx\r
44 jrcxz .1\r
45 mov [rcx], eax\r
46.1:\r
47 mov rcx, r8\r
48 jrcxz .2\r
49 mov [rcx], ebx\r
50.2:\r
51 mov rcx, [rsp + 0x38]\r
52 jrcxz .3\r
53 mov [rcx], edx\r
54.3:\r
55 pop rax ; restore Index to rax as return value\r
56 pop rbx\r
57 ret\r
58\r