2009-05-14 17:55:28 +02:00
|
|
|
! _cpuid() - interface to cpuid instruction
|
|
|
|
|
|
|
|
.sect .text; .sect .rom; .sect .data; .sect .bss
|
|
|
|
.sect .text
|
|
|
|
|
2010-01-15 16:23:57 +01:00
|
|
|
! void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
|
2009-05-14 17:55:28 +02:00
|
|
|
|
|
|
|
.define __cpuid
|
|
|
|
|
|
|
|
__cpuid:
|
2010-01-15 16:23:57 +01:00
|
|
|
! save registers
|
2009-05-14 17:55:28 +02:00
|
|
|
push ebp
|
|
|
|
push ebx
|
|
|
|
|
2010-01-15 16:23:57 +01:00
|
|
|
! set parameters to cpuid and execute cpuid
|
|
|
|
mov ebp, 12(esp)
|
|
|
|
mov eax, (ebp)
|
|
|
|
mov ebp, 16(esp)
|
|
|
|
mov ebx, (ebp)
|
|
|
|
mov ebp, 20(esp)
|
|
|
|
mov ecx, (ebp)
|
|
|
|
mov ebp, 24(esp)
|
|
|
|
mov edx, (ebp)
|
2009-05-14 17:55:28 +02:00
|
|
|
.data1 0x0F, 0xA2 ! CPUID
|
|
|
|
|
|
|
|
! store results in pointer arguments
|
2010-01-15 16:23:57 +01:00
|
|
|
mov ebp, 12(esp)
|
2009-05-14 17:55:28 +02:00
|
|
|
mov (ebp), eax
|
2010-01-15 16:23:57 +01:00
|
|
|
mov ebp, 16(esp)
|
2009-05-14 17:55:28 +02:00
|
|
|
mov (ebp), ebx
|
2010-01-15 16:23:57 +01:00
|
|
|
mov ebp, 20(esp)
|
2009-05-14 17:55:28 +02:00
|
|
|
mov (ebp), ecx
|
2010-01-15 16:23:57 +01:00
|
|
|
mov ebp, 24(esp)
|
2009-05-14 17:55:28 +02:00
|
|
|
mov (ebp), edx
|
|
|
|
|
|
|
|
! restore registers
|
|
|
|
pop ebx
|
|
|
|
pop ebp
|
|
|
|
|
|
|
|
ret
|