--- ./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) ); }