]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Library/BaseLib/Ia32/CpuId.asm
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Library / BaseLib / Ia32 / CpuId.asm
diff --git a/OldMdePkg/Library/BaseLib/Ia32/CpuId.asm b/OldMdePkg/Library/BaseLib/Ia32/CpuId.asm
new file mode 100644 (file)
index 0000000..5c0eb1f
--- /dev/null
@@ -0,0 +1,66 @@
+;------------------------------------------------------------------------------\r
+;\r
+; Copyright (c) 2006, Intel Corporation\r
+; All rights reserved. This program and the accompanying materials\r
+; are licensed and made available under the terms and conditions of the BSD License\r
+; which accompanies this distribution.  The full text of the license may be found at\r
+; http://opensource.org/licenses/bsd-license.php\r
+;\r
+; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+;\r
+; Module Name:\r
+;\r
+;   CpuId.Asm\r
+;\r
+; Abstract:\r
+;\r
+;   AsmCpuid function\r
+;\r
+; Notes:\r
+;\r
+;------------------------------------------------------------------------------\r
+\r
+    .586P\r
+    .model  flat,C\r
+    .code\r
+\r
+;------------------------------------------------------------------------------\r
+;  VOID\r
+;  EFIAPI\r
+;  AsmCpuid (\r
+;    IN   UINT32  RegisterInEax,\r
+;    OUT  UINT32  *RegisterOutEax  OPTIONAL,\r
+;    OUT  UINT32  *RegisterOutEbx  OPTIONAL,\r
+;    OUT  UINT32  *RegisterOutEcx  OPTIONAL,\r
+;    OUT  UINT32  *RegisterOutEdx  OPTIONAL\r
+;    );\r
+;------------------------------------------------------------------------------\r
+AsmCpuid    PROC    USES    ebx\r
+    push    ebp\r
+    mov     ebp, esp\r
+    mov     eax, [ebp + 12]\r
+    cpuid\r
+    push    ecx\r
+    mov     ecx, [ebp + 16]\r
+    jecxz   @F\r
+    mov     [ecx], eax\r
+@@:\r
+    mov     ecx, [ebp + 20]\r
+    jecxz   @F\r
+    mov     [ecx], ebx\r
+@@:\r
+    mov     ecx, [ebp + 24]\r
+    jecxz   @F\r
+    pop     [ecx]\r
+@@:\r
+    mov     ecx, [ebp + 28]\r
+    jecxz   @F\r
+    mov     [ecx], edx\r
+@@:\r
+    mov     eax, [ebp + 12]\r
+    leave\r
+    ret\r
+AsmCpuid    ENDP\r
+\r
+    END\r