diff -urN upp-x11-src-2361/uppsrc/Core/Cpu.cpp upp-x11-src-2361-dwokfur/uppsrc/Core/Cpu.cpp --- upp-x11-src-2361/uppsrc/Core/Cpu.cpp 2010-05-04 03:32:13.000000000 +0200 +++ upp-x11-src-2361-dwokfur/uppsrc/Core/Cpu.cpp 2010-07-05 23:13:37.000000000 +0200 @@ -37,8 +37,22 @@ #else dword info1; dword info2; + /* call the cpuid instruction with the registers as input and output + * modification by Dwokfur based on Sam Hocevar's discussion on + * how to make Assemly code PIC compatible: + * http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well + */ +#ifdef __PIC__ + __asm__("pushl %%ebx \n\t" /* save %ebx */ + "movl $1, %%eax \n\t" + "cpuid \n\t" + "popl %%ebx \n\t" /* restore the old %ebx */ + : "=d" (info1), "=c" (info2) + : : "%eax"); +#else __asm__("movl $1, %%eax\n\tcpuid" : "=d" (info1), "=c" (info2) : : "%eax", "%ebx"); #endif +#endif sHasMMX = ((info1 >> 23) & 0x1); sHasSSE = ((info1 >> 25) & 0x1); sHasSSE2 = ((info1 >> 26) & 0x1);