http://codereview.appspot.com/150060
git-svn-id: http://skia.googlecode.com/svn/trunk@421
2bbb7eff-a529-9590-31e7-
b0007b416f81
#else
static void getcpuid(int info_type, int info[4])
{
- asm("cpuid": "=a" (info[0]), "=b" (info[1]), "=c" (info[2]), "=d" (info[3])
- : "a"(info_type)
- :
- );
+ // We save and restore ebx, so this code can be compatible with -fPIC
+ asm volatile (
+ "pushl %%ebx \n\t"
+ "cpuid \n\t"
+ "movl %%ebx, %1 \n\t"
+ "popl %%ebx \n\t"
+ : "=a"(info[0]), "=r"(info[1]), "=c"(info[2]), "=d"(info[3])
+ : "a"(info_type)
+ :
+ );
}
#endif