-+#define cpuid(in,a,b,c,d)\
-+ asm("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
++/* Thanks to the ffmpeg team for this PIC version of cpuid() */
++#ifdef ARCH_X86_64
++# define REG_b "rbx"
++# define REG_S "rsi"
++#else
++# define REG_b "ebx"
++# define REG_S "esi"
++#endif
++#define cpuid(index,eax,ebx,ecx,edx)\
++ __asm __volatile\
++ ("mov %%"REG_b", %%"REG_S"\n\t"\
++ "cpuid\n\t"\
++ "xchg %%"REG_b", %%"REG_S\
++ : "=a" (eax), "=S" (ebx),\
++ "=c" (ecx), "=d" (edx)\
++ : "0" (index));