Use <sys/cpu.h> where it makes sense.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
struct cpuid_data data;
};
-static bool has_eflag(uint32_t flag)
-{
- uint32_t f0, f1;
-
- asm("pushfl ; "
- "pushfl ; "
- "popl %0 ; "
- "movl %0,%1 ; "
- "xorl %2,%1 ; "
- "pushl %1 ; "
- "popfl ; "
- "pushfl ; "
- "popl %1 ; "
- "popfl"
- : "=&r" (f0), "=&r" (f1)
- : "ri" (flag));
-
- return !!((f0^f1) & flag);
-}
-
static void get_cpuid(uint32_t eax, uint32_t ecx, struct cpuid_data *data)
{
asm("pushl %%ebx ; cpuid ; movl %%ebx,%1 ; popl %%ebx"
struct cpuid_data invalid_leaf;
struct cpuid_data data;
- if (!has_eflag(EFLAGS_ID))
+ if (!cpu_has_eflag(EFLAGS_ID))
return;
printf("Dumping CPUID... ");