2010-03-03 15:27:30 +01:00
|
|
|
/* _cpuid() - interface to cpuid instruction */
|
|
|
|
|
|
|
|
|
|
|
|
/* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */
|
|
|
|
/* 0 for OK, nonzero for unsupported */
|
|
|
|
|
2010-08-17 18:44:07 +02:00
|
|
|
#include <machine/asm.h>
|
2010-03-03 15:27:30 +01:00
|
|
|
|
2010-08-17 18:44:07 +02:00
|
|
|
ENTRY(_cpuid)
|
2010-03-03 15:27:30 +01:00
|
|
|
/* save work registers */
|
|
|
|
push %ebp
|
|
|
|
push %ebx
|
|
|
|
|
|
|
|
/* set eax parameter to cpuid and execute cpuid */
|
|
|
|
movl 12(%esp), %ebp
|
|
|
|
mov (%ebp), %eax
|
|
|
|
movl 16(%esp), %ebp
|
|
|
|
mov (%ebp), %ebx
|
|
|
|
movl 20(%esp), %ebp
|
|
|
|
mov (%ebp), %ecx
|
|
|
|
movl 24(%esp), %ebp
|
|
|
|
mov (%ebp), %edx
|
|
|
|
|
|
|
|
.byte 0x0F, 0xA2 /* CPUID */
|
|
|
|
|
|
|
|
/* store results in pointer arguments */
|
|
|
|
movl 12(%esp), %ebp
|
|
|
|
movl %eax, (%ebp)
|
|
|
|
movl 16(%esp), %ebp
|
|
|
|
movl %ebx, (%ebp)
|
|
|
|
movl 20(%esp), %ebp
|
|
|
|
movl %ecx, (%ebp)
|
|
|
|
movl 24(%esp), %ebp
|
|
|
|
movl %edx, (%ebp)
|
|
|
|
|
|
|
|
/* restore registers */
|
|
|
|
pop %ebx
|
|
|
|
pop %ebp
|
|
|
|
|
|
|
|
ret
|