aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/boot/cpucheck.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-08-22 19:28:01 -0400
committerH. Peter Anvin <hpa@zytor.com>2007-08-23 16:03:25 -0400
commitb015124e562a040f7faf361c72e8f5f457ac6cf5 (patch)
tree452f3fe6b9a7d2ef692e021a18f588490bc78441 /arch/i386/boot/cpucheck.c
parentb377fd3982ad957c796758a90e2988401a884241 (diff)
[x86 setup] Volatilize asm() statements
asm() statements need to be volatile when: a. They have side effects (other than value returned). b. When the value returned can vary over time. c. When they have ordering constraints that cannot be expressed to gcc. In particular, the keyboard and timer reads were violating constraint (b), which resulted in the keyboard/timeout poll getting loop-invariant-removed when compiling with gcc 4.2.0. Thanks to an anonymous bug reporter for pointing this out. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/i386/boot/cpucheck.c')
-rw-r--r--arch/i386/boot/cpucheck.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/i386/boot/cpucheck.c b/arch/i386/boot/cpucheck.c
index 991e8ceae1de..e655a89c5510 100644
--- a/arch/i386/boot/cpucheck.c
+++ b/arch/i386/boot/cpucheck.c
@@ -96,7 +96,8 @@ static int has_fpu(void)
96 asm volatile("movl %0,%%cr0" : : "r" (cr0)); 96 asm volatile("movl %0,%%cr0" : : "r" (cr0));
97 } 97 }
98 98
99 asm("fninit ; fnstsw %0 ; fnstcw %1" : "+m" (fsw), "+m" (fcw)); 99 asm volatile("fninit ; fnstsw %0 ; fnstcw %1"
100 : "+m" (fsw), "+m" (fcw));
100 101
101 return fsw == 0 && (fcw & 0x103f) == 0x003f; 102 return fsw == 0 && (fcw & 0x103f) == 0x003f;
102} 103}