minix/lib/libc/arch/i386/misc/_cpuid.s

41 lines
669 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
! 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:
! save registers
2009-05-14 17:55:28 +02:00
push ebp
push ebx
! 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
mov ebp, 12(esp)
2009-05-14 17:55:28 +02:00
mov (ebp), eax
mov ebp, 16(esp)
2009-05-14 17:55:28 +02:00
mov (ebp), ebx
mov ebp, 20(esp)
2009-05-14 17:55:28 +02:00
mov (ebp), ecx
mov ebp, 24(esp)
2009-05-14 17:55:28 +02:00
mov (ebp), edx
! restore registers
pop ebx
pop ebp
ret