minix/lib/i386/misc/_cpuid.s

44 lines
641 B
ArmAsm
Raw Normal View History

2009-05-14 17:55:28 +02:00
! _cpuid() - interface to cpuid instruction
.sect .text; .sect .rom; .sect .data; .sect .bss
.sect .text
2009-09-21 16:46:10 +02:00
! void _cpuid(u32_t eax, u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx);
2009-05-14 17:55:28 +02:00
.define __cpuid
__cpuid:
push ebp
mov ebp, esp
! save work registers
push eax
push ebx
push ecx
push edx
! set eax parameter to cpuid and execute cpuid
mov eax, 24(esp)
.data1 0x0F, 0xA2 ! CPUID
! store results in pointer arguments
mov ebp, 28(esp)
mov (ebp), eax
mov ebp, 32(esp)
mov (ebp), ebx
mov ebp, 36(esp)
mov (ebp), ecx
mov ebp, 40(esp)
mov (ebp), edx
! restore registers
pop edx
pop ecx
pop ebx
pop eax
pop ebp
ret