sysdump: use <sys/cpu.h>
authorH. Peter Anvin <hpa@zytor.com>
Tue, 11 May 2010 19:59:56 +0000 (12:59 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 11 May 2010 19:59:56 +0000 (12:59 -0700)
Use <sys/cpu.h> where it makes sense.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/sysdump/cpuid.c

index ac80f22..372a70d 100644 (file)
@@ -19,26 +19,6 @@ struct cpuid_info {
     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"
@@ -59,7 +39,7 @@ void dump_cpuid(struct backend *be)
     struct cpuid_data invalid_leaf;
     struct cpuid_data data;
 
-    if (!has_eflag(EFLAGS_ID))
+    if (!cpu_has_eflag(EFLAGS_ID))
        return;
 
     printf("Dumping CPUID... ");