|
|
@ -45,25 +45,25 @@ int mm_support(void) |
|
|
|
long a, c; |
|
|
|
long a, c; |
|
|
|
|
|
|
|
|
|
|
|
__asm__ __volatile__ ( |
|
|
|
__asm__ __volatile__ ( |
|
|
|
/* See if CPUID instruction is supported ... */ |
|
|
|
/* See if CPUID instruction is supported ... */ |
|
|
|
/* ... Get copies of EFLAGS into eax and ecx */ |
|
|
|
/* ... Get copies of EFLAGS into eax and ecx */ |
|
|
|
"pushf\n\t" |
|
|
|
"pushf\n\t" |
|
|
|
"pop %0\n\t" |
|
|
|
"pop %0\n\t" |
|
|
|
"mov %0, %1\n\t" |
|
|
|
"mov %0, %1\n\t" |
|
|
|
|
|
|
|
|
|
|
|
/* ... Toggle the ID bit in one copy and store */ |
|
|
|
/* ... Toggle the ID bit in one copy and store */ |
|
|
|
/* to the EFLAGS reg */ |
|
|
|
/* to the EFLAGS reg */ |
|
|
|
"xor $0x200000, %0\n\t" |
|
|
|
"xor $0x200000, %0\n\t" |
|
|
|
"push %0\n\t" |
|
|
|
"push %0\n\t" |
|
|
|
"popf\n\t" |
|
|
|
"popf\n\t" |
|
|
|
|
|
|
|
|
|
|
|
/* ... Get the (hopefully modified) EFLAGS */ |
|
|
|
/* ... Get the (hopefully modified) EFLAGS */ |
|
|
|
"pushf\n\t" |
|
|
|
"pushf\n\t" |
|
|
|
"pop %0\n\t" |
|
|
|
"pop %0\n\t" |
|
|
|
: "=a" (a), "=c" (c) |
|
|
|
: "=a" (a), "=c" (c) |
|
|
|
: |
|
|
|
: |
|
|
|
: "cc" |
|
|
|
: "cc" |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (a == c) |
|
|
|
if (a == c) |
|
|
|
return 0; /* CPUID not supported */ |
|
|
|
return 0; /* CPUID not supported */ |
|
|
@ -119,9 +119,9 @@ int mm_support(void) |
|
|
|
#ifdef TEST |
|
|
|
#ifdef TEST |
|
|
|
int main ( void ) |
|
|
|
int main ( void ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int mm_flags; |
|
|
|
int mm_flags; |
|
|
|
mm_flags = mm_support(); |
|
|
|
mm_flags = mm_support(); |
|
|
|
printf("mm_support = 0x%08X\n",mm_flags); |
|
|
|
printf("mm_support = 0x%08X\n",mm_flags); |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|