cpuid is not going to change more than ebx, even on x86_64
This commit is contained in:
parent
f601e6e471
commit
f8c49ac54f
@ -46,12 +46,19 @@ _cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
|
||||
#ifdef _MSC_VER
|
||||
__cpuidex((int *) cpu_info, cpu_info_type, 0);
|
||||
#elif defined(HAVE_CPUID)
|
||||
# ifdef __x86_64__
|
||||
__asm__ __volatile__ ("xchgq %%rbx, %q1; cpuid; xchgq %%rbx, %q1" :
|
||||
"=a" (cpu_info[0]), "=&r" (cpu_info[1]),
|
||||
"=c" (cpu_info[2]), "=d" (cpu_info[3]) :
|
||||
"a" (cpu_info_type), "c" (0U));
|
||||
# elif defined(__i386__)
|
||||
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
|
||||
# if defined(__i386__) && !defined(__x86_64__)
|
||||
__asm__ __volatile__ ("pushfl; pushfl; "
|
||||
"popl %0; "
|
||||
"movl %0, %1; xorl %2, %0; "
|
||||
"pushl %0; "
|
||||
"popfl; pushfl; popl %0; popfl" :
|
||||
"=&r" (cpu_info[0]), "=&r" (cpu_info[1]) :
|
||||
"i" (0x200000));
|
||||
if (((cpu_info[0] ^ cpu_info[1]) & 0x200000) == 0x0) {
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
__asm__ __volatile__ ("xchgl %%ebx, %k1; cpuid; xchgl %%ebx, %k1" :
|
||||
"=a" (cpu_info[0]), "=&r" (cpu_info[1]),
|
||||
"=c" (cpu_info[2]), "=d" (cpu_info[3]) :
|
||||
@ -59,9 +66,6 @@ _cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
|
||||
#else
|
||||
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
|
||||
#endif
|
||||
#else
|
||||
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user