Constify node_cmp_attr_func.
[libfirm] / ir / be / ia32 / ia32_architecture.c
index 78bca5a..2ffda78 100644 (file)
@@ -740,12 +740,25 @@ typedef union {
 static void x86_cpuid(cpuid_registers *regs, unsigned level)
 {
 #if defined(__GNUC__)
+#      if defined(__PIC__) && !defined(__amd64) // GCC cannot handle EBX in PIC
+       __asm (
+               "pushl %%ebx\n\t"
+               "cpuid\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);
+#else
+#      error CPUID is missing
 #endif
 }