1;------------------------------------------------------------------------------ 2; 3; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> 4; This program and the accompanying materials 5; are licensed and made available under the terms and conditions of the BSD License 6; which accompanies this distribution. The full text of the license may be found at 7; http://opensource.org/licenses/bsd-license.php. 8; 9; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11; 12; Module Name: 13; 14; CpuId.Asm 15; 16; Abstract: 17; 18; AsmCpuid function 19; 20; Notes: 21; 22;------------------------------------------------------------------------------ 23 24 DEFAULT REL 25 SECTION .text 26 27;------------------------------------------------------------------------------ 28; VOID 29; EFIAPI 30; AsmCpuid ( 31; IN UINT32 RegisterInEax, 32; OUT UINT32 *RegisterOutEax OPTIONAL, 33; OUT UINT32 *RegisterOutEbx OPTIONAL, 34; OUT UINT32 *RegisterOutEcx OPTIONAL, 35; OUT UINT32 *RegisterOutEdx OPTIONAL 36; ) 37;------------------------------------------------------------------------------ 38global ASM_PFX(AsmCpuid) 39ASM_PFX(AsmCpuid): 40 push rbx 41 mov eax, ecx 42 push rax ; save Index on stack 43 push rdx 44 cpuid 45 test r9, r9 46 jz .0 47 mov [r9], ecx 48.0: 49 pop rcx 50 jrcxz .1 51 mov [rcx], eax 52.1: 53 mov rcx, r8 54 jrcxz .2 55 mov [rcx], ebx 56.2: 57 mov rcx, [rsp + 0x38] 58 jrcxz .3 59 mov [rcx], edx 60.3: 61 pop rax ; restore Index to rax as return value 62 pop rbx 63 ret 64 65