Saving %rbx may actually be required depending on the memory model.
This commit is contained in:
parent
95d9a625db
commit
a234e505f9
@ -47,7 +47,7 @@ _cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
|
||||
__cpuidex((int *) cpu_info, cpu_info_type, 0);
|
||||
#elif defined(HAVE_CPUID)
|
||||
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
|
||||
# if defined(__i386__) && !defined(__x86_64__)
|
||||
# ifdef __i386__
|
||||
__asm__ __volatile__ ("pushfl; pushfl; "
|
||||
"popl %0; "
|
||||
"movl %0, %1; xorl %2, %0; "
|
||||
@ -59,10 +59,22 @@ _cpuid(unsigned int cpu_info[4U], const unsigned int cpu_info_type)
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
# ifdef __i386__
|
||||
__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]) :
|
||||
"0" (cpu_info_type), "2" (0U));
|
||||
# elif defined(__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]) :
|
||||
"0" (cpu_info_type), "2" (0U));
|
||||
# else
|
||||
__asm__ __volatile__ ("cpuid" :
|
||||
"=a" (cpu_info[0]), "=b" (cpu_info[1]),
|
||||
"=c" (cpu_info[2]), "=d" (cpu_info[3]) :
|
||||
"0" (cpu_info_type), "2" (0U));
|
||||
# endif
|
||||
#else
|
||||
cpu_info[0] = cpu_info[1] = cpu_info[2] = cpu_info[3] = 0;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user