Ok, now we actually check if we can use cpuid before using it. With evil AT&T inlined ASM from ui.asm [Nach]
This commit is contained in:
@@ -306,6 +306,26 @@ if test x$enable_cpucheck != xno; then
|
||||
}
|
||||
}
|
||||
|
||||
int have_cpuid()
|
||||
{
|
||||
int have = 0x200000;
|
||||
asm volatile
|
||||
(
|
||||
"pushfl \n\t"
|
||||
"pop %%eax \n\t"
|
||||
"movl %%eax,%%edx \n\t"
|
||||
"xorl %%ecx,%%eax \n\t"
|
||||
"push %%eax \n\t"
|
||||
"popfl \n\t"
|
||||
"pushfl \n\t"
|
||||
"pop %%eax \n\t"
|
||||
"xorl %%edx,%%eax \n\t"
|
||||
: "=a" (have)
|
||||
: "c" (have)
|
||||
);
|
||||
return(have);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char model_name[216], flags[216], cpu_family[216];
|
||||
@@ -342,7 +362,7 @@ if test x$enable_cpucheck != xno; then
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
else
|
||||
else if (have_cpuid())
|
||||
{
|
||||
unsigned int maxei, eax, ebx, ecx, edx, unused, i;
|
||||
|
||||
@@ -395,6 +415,8 @@ if test x$enable_cpucheck != xno; then
|
||||
}
|
||||
}
|
||||
|
||||
if (*cpu_family && *vendor_id)
|
||||
{
|
||||
if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD"))
|
||||
{
|
||||
if (strstr(flags, " mmx "))
|
||||
@@ -528,6 +550,7 @@ if test x$enable_cpucheck != xno; then
|
||||
fclose(fp);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user