1/* _cpuid() - interface to cpuid instruction */ 2 3 4/* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */ 5/* 0 for OK, nonzero for unsupported */ 6 7#include <machine/asm.h> 8 9ENTRY(_cpuid) 10/* save work registers */ 11 push %ebp 12 push %ebx 13 14/* set eax parameter to cpuid and execute cpuid */ 15 movl 12(%esp), %ebp 16 mov (%ebp), %eax 17 movl 16(%esp), %ebp 18 mov (%ebp), %ebx 19 movl 20(%esp), %ebp 20 mov (%ebp), %ecx 21 movl 24(%esp), %ebp 22 mov (%ebp), %edx 23 24.byte 0x0F, 0xA2 /* CPUID */ 25 26/* store results in pointer arguments */ 27 movl 12(%esp), %ebp 28 movl %eax, (%ebp) 29 movl 16(%esp), %ebp 30 movl %ebx, (%ebp) 31 movl 20(%esp), %ebp 32 movl %ecx, (%ebp) 33 movl 24(%esp), %ebp 34 movl %edx, (%ebp) 35 36/* restore registers */ 37 pop %ebx 38 pop %ebp 39 40 ret 41