Commit ad626856 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Do not use b (ebx) as asm constraint, when compiling with __PIC__. GCC cannot handle this.

parent c8a000c8
......@@ -740,10 +740,21 @@ typedef union {
static void x86_cpuid(cpuid_registers *regs, unsigned level)
#if defined(__GNUC__)
# ifdef __PIC__ // GCC cannot handle EBX in PIC
__asm (
"pushl %%ebx\n\t"
"movl %%ebx, %1\n\t"
"popl %%ebx"
: "=a" (regs->r.eax), "=r" (regs->r.ebx), "=c" (regs->r.ecx), "=d" (regs->r.edx)
: "a" (level)
# else
__asm ("cpuid\n\t"
: "=a" (regs->r.eax), "=b" (regs->r.ebx), "=c" (regs->r.ecx), "=d" (regs->r.edx)
: "a" (level)
# endif
#elif defined(_MSC_VER)
__cpuid(regs->bulk, level);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment