|
@@ -124,18 +124,25 @@ static inline int flag_is_changeable_p(u32 flag)
|
|
|
{
|
|
|
u32 f1, f2;
|
|
|
|
|
|
- asm("pushfl\n\t"
|
|
|
- "pushfl\n\t"
|
|
|
- "popl %0\n\t"
|
|
|
- "movl %0,%1\n\t"
|
|
|
- "xorl %2,%0\n\t"
|
|
|
- "pushl %0\n\t"
|
|
|
- "popfl\n\t"
|
|
|
- "pushfl\n\t"
|
|
|
- "popl %0\n\t"
|
|
|
- "popfl\n\t"
|
|
|
- : "=&r" (f1), "=&r" (f2)
|
|
|
- : "ir" (flag));
|
|
|
+ /*
|
|
|
+ * Cyrix and IDT cpus allow disabling of CPUID
|
|
|
+ * so the code below may return different results
|
|
|
+ * when it is executed before and after enabling
|
|
|
+ * the CPUID. Add "volatile" to not allow gcc to
|
|
|
+ * optimize the subsequent calls to this function.
|
|
|
+ */
|
|
|
+ asm volatile ("pushfl\n\t"
|
|
|
+ "pushfl\n\t"
|
|
|
+ "popl %0\n\t"
|
|
|
+ "movl %0,%1\n\t"
|
|
|
+ "xorl %2,%0\n\t"
|
|
|
+ "pushl %0\n\t"
|
|
|
+ "popfl\n\t"
|
|
|
+ "pushfl\n\t"
|
|
|
+ "popl %0\n\t"
|
|
|
+ "popfl\n\t"
|
|
|
+ : "=&r" (f1), "=&r" (f2)
|
|
|
+ : "ir" (flag));
|
|
|
|
|
|
return ((f1^f2) & flag) != 0;
|
|
|
}
|