summaryrefslogtreecommitdiff
path: root/cpuid_x86.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpuid_x86.c')
-rw-r--r--cpuid_x86.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/cpuid_x86.c b/cpuid_x86.c
index 53016e1e7..f9df7221b 100644
--- a/cpuid_x86.c
+++ b/cpuid_x86.c
@@ -59,9 +59,16 @@
void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx);
#else
static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx){
+#if defined(__i386__) && defined(__PIC__)
+ __asm__ __volatile__
+ ("mov %%ebx, %%edi;"
+ "cpuid;"
+ "xchgl %%ebx, %%edi;"
+ : "=a" (*eax), "=D" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (op) : "cc");
+#else
__asm__ __volatile__
("cpuid": "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (op) : "cc");
-
+#endif
}
#endif