Commit 3850427d authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Greg Kroah-Hartman

x86: fdiv bug detection fix

commit e0d22d03 upstream

The fdiv detection code writes s32 integer into
the boot_cpu_data.fdiv_bug.
However, the boot_cpu_data.fdiv_bug is only char (s8)
field so the detection overwrites already set fields for
other bugs, e.g. the f00f bug field.

Use local s32 variable to receive result.

This is a partial fix to Bugzilla #9928  - fixes wrong
information about the f00f bug (tested) and probably
for coma bug (I have no cpu to test this).
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 939a3b79
...@@ -50,6 +50,8 @@ static double __initdata y = 3145727.0; ...@@ -50,6 +50,8 @@ static double __initdata y = 3145727.0;
*/ */
static void __init check_fpu(void) static void __init check_fpu(void)
{ {
s32 fdiv_bug;
if (!boot_cpu_data.hard_math) { if (!boot_cpu_data.hard_math) {
#ifndef CONFIG_MATH_EMULATION #ifndef CONFIG_MATH_EMULATION
printk(KERN_EMERG "No coprocessor found and no math emulation present.\n"); printk(KERN_EMERG "No coprocessor found and no math emulation present.\n");
...@@ -70,8 +72,10 @@ static void __init check_fpu(void) ...@@ -70,8 +72,10 @@ static void __init check_fpu(void)
"fistpl %0\n\t" "fistpl %0\n\t"
"fwait\n\t" "fwait\n\t"
"fninit" "fninit"
: "=m" (*&boot_cpu_data.fdiv_bug) : "=m" (*&fdiv_bug)
: "m" (*&x), "m" (*&y)); : "m" (*&x), "m" (*&y));
boot_cpu_data.fdiv_bug = fdiv_bug;
if (boot_cpu_data.fdiv_bug) if (boot_cpu_data.fdiv_bug)
printk("Hmm, FPU with FDIV bug.\n"); printk("Hmm, FPU with FDIV bug.\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment