2014-09-29 11:50:09 +08:00
|
|
|
|
|
|
|
SECTION .text
|
|
|
|
|
|
|
|
%macro PROC 1
|
|
|
|
align 16
|
|
|
|
global %1
|
|
|
|
%1:
|
|
|
|
%endmacro
|
|
|
|
|
|
|
|
;int
|
|
|
|
;cpuid_x86(int eax_in, int ecx_in, int *eax, int *ebx, int *ecx, int *edx)
|
|
|
|
|
|
|
|
PROC cpuid_x86
|
|
|
|
; save registers
|
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
push edx
|
2014-09-30 10:33:39 +08:00
|
|
|
push edi
|
2014-09-29 11:50:09 +08:00
|
|
|
; cpuid
|
2014-09-30 10:33:39 +08:00
|
|
|
mov eax, [esp + 20]
|
|
|
|
mov ecx, [esp + 24]
|
2014-09-29 11:50:09 +08:00
|
|
|
cpuid
|
2014-09-30 10:33:39 +08:00
|
|
|
mov edi, [esp + 28]
|
|
|
|
mov [edi], eax
|
|
|
|
mov edi, [esp + 32]
|
|
|
|
mov [edi], ebx
|
|
|
|
mov edi, [esp + 36]
|
|
|
|
mov [edi], ecx
|
|
|
|
mov edi, [esp + 40]
|
|
|
|
mov [edi], edx
|
2014-09-29 11:50:09 +08:00
|
|
|
mov eax, 0
|
|
|
|
; restore registers
|
2014-09-30 10:33:39 +08:00
|
|
|
pop edi
|
2014-09-29 11:50:09 +08:00
|
|
|
pop edx
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
|
|
|
ret;
|
|
|
|
align 16
|
|
|
|
|