The 'cpuid' assembly instruction is notorious for hating PIC. Here we code two different versions of the cpuid instruction ... the first will work when dealing with PIC, while the second is slightly faster and can be used with non-PIC. http://bugs.gentoo.org/show_bug.cgi?id=61947 --- src/core/cpuid.cc.orig 2005-01-03 15:21:57.034862112 -0500 +++ src/core/cpuid.cc 2005-01-03 16:07:00.131928896 -0500 @@ -68,9 +68,6 @@ #ifdef __i386__ -#define cpuid_up(in,a,b,c,d)\ - asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in)); - static void cpuid(int cpunumber, unsigned long idx, unsigned long &eax, @@ -96,7 +93,18 @@ edx = (*(unsigned long *) (buffer + 12)); } else - cpuid_up(idx, eax, ebx, ecx, edx); + asm( +#ifdef __PIC__ + "pushl %%ebx\n" + "cpuid\n" + "movl %%ebx,%3\n" + "popl %%ebx\n" + : "=a" (eax), "=c" (ecx), "=d" (edx), "=m" (ebx) +#else + "cpuid\n" + : "=a" (eax), "=c" (ecx), "=d" (edx), "=b" (ebx) +#endif + : "a" (idx)); } /* Decode Intel TLB and cache info descriptors */