]> code.delx.au - pulseaudio/commitdiff
core: make cpuid code compile cleanly with 32bit PIC
authorLennart Poettering <lennart@poettering.net>
Wed, 11 Nov 2009 03:50:32 +0000 (04:50 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 11 Nov 2009 03:50:32 +0000 (04:50 +0100)
src/pulsecore/core-util.c

index 93ddf3011e796cc01e8042ca33b5367ac88fd9cf..d596c481a9b3c1f5336867b8854b2b9a3a34fbcc 100644 (file)
 #include <pulsecore/strbuf.h>
 #include <pulsecore/usergroup.h>
 #include <pulsecore/strlist.h>
+#include <pulsecore/cpu-x86.h>
 
 #include "core-util.h"
 
@@ -3085,10 +3086,13 @@ pa_bool_t pa_running_in_vm(void) {
     pa_zero(sig);
 
     __asm__ __volatile__ (
-        "  xor %%ebx, %%ebx          \n\t"
+        /* ebx/rbx is being used for PIC! */
+        "  push %%"PA_REG_b"         \n\t"
         "  cpuid                     \n\t"
+        "  mov %%ebx, %1             \n\t"
+        "  pop %%"PA_REG_b"          \n\t"
 
-        : "=a" (eax), "=b" (sig.sig32[0]), "=c" (sig.sig32[1]), "=d" (sig.sig32[2])
+        : "=a" (eax), "=r" (sig.sig32[0]), "=c" (sig.sig32[1]), "=d" (sig.sig32[2])
         : "0" (eax)
     );