core-util, cpu-x86: use __get_cpuid() instead of homegrown assembly

The get_cpuid() function in cpu-x86.c was buggy on x86-64. When building
without optimizations, the homegrown assembly code overwrote the
beginning of the function argument list on the stack. That happened to
work fine on regular x86-64, but caused crashing with the x32 ABI.

At least GCC and clang provide cpuid.h, which has the __get_cpuid()
function that can be used instead of the homegrown assembly.

The PA_REG_* constants can be removed as well, because they're not used
any more.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=103656
This commit is contained in:
Tanu Kaskinen 2017-11-22 17:14:10 +02:00
parent 2062fc8b0e
commit c8bd93c5a7
4 changed files with 38 additions and 48 deletions

View file

@ -43,20 +43,8 @@ bool pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags);
#if defined (__i386__)
typedef int32_t pa_reg_x86;
#define PA_REG_a "eax"
#define PA_REG_b "ebx"
#define PA_REG_c "ecx"
#define PA_REG_d "edx"
#define PA_REG_D "edi"
#define PA_REG_S "esi"
#elif defined (__amd64__)
typedef int64_t pa_reg_x86;
#define PA_REG_a "rax"
#define PA_REG_b "rbx"
#define PA_REG_c "rcx"
#define PA_REG_d "rdx"
#define PA_REG_D "rdi"
#define PA_REG_S "rsi"
#endif
/* some optimized functions */