summaryrefslogtreecommitdiffstats
path: root/main/xen/xen-x86-pic.patch
blob: dcb4d0d81733e37163bae8633424578875eac46d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--- ./tools/misc/xen-detect.c.orig
+++ ./tools/misc/xen-detect.c
@@ -41,8 +41,16 @@
                   int pv_context)
 {
     asm volatile (
+#if defined(__PIC__) && defined(__i386__)
+        "movl %%ebx, %%edi ;"
+        "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ;"
+        "1: cpuid ; "
+        "xchg %%ebx, %%edi"
+        : "=a" (*eax), "=D" (*ebx), "=c" (*ecx), "=d" (*edx)
+#else
         "test %1,%1 ; jz 1f ; ud2a ; .ascii \"xen\" ; 1: cpuid"
         : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+#endif
         : "0" (idx), "1" (pv_context) );
 }