From 82817ed9dfc3838d82f53cd0e8008df41c067be7 Mon Sep 17 00:00:00 2001 From: Krzysztof Helt Date: Tue, 30 Sep 2008 23:17:51 +0200 Subject: [PATCH] --- yaml --- r: 113551 b: refs/heads/master c: 94f6bac1058fd59a8bd472d18c4b77f220d930b0 h: refs/heads/master i: 113549: 0b556fb3030642516d369dac1de01c2a057aefac 113547: ba795d6b254a01e17425ab1e8f5cc2b629bfef37 113543: 0eaecec027d1225fe8aeea0d990d357c7053d7d9 113535: dcfe9fd81e15347830438ebe6ef0ea521f2d66d9 v: v3 --- [refs] | 2 +- trunk/arch/x86/kernel/cpu/common.c | 31 ++++++++++++++++++------------ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 012879a3728e..43ad8e866d1e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e2ce07c8042975e52df4cec1f41faf15b83f2e42 +refs/heads/master: 94f6bac1058fd59a8bd472d18c4b77f220d930b0 diff --git a/trunk/arch/x86/kernel/cpu/common.c b/trunk/arch/x86/kernel/cpu/common.c index f1af71851919..25581dcb280e 100644 --- a/trunk/arch/x86/kernel/cpu/common.c +++ b/trunk/arch/x86/kernel/cpu/common.c @@ -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; }