2 * Copyright (C) 1994 Linus Torvalds
4 * Cyrix stuff, June 1998 by:
5 * - Rafael R. Reilova (moved everything from head.S),
6 * <rreilova@ececs.uc.edu>
7 * - Channing Corn (tests & fixes),
8 * - Andrew D. Balsa (code cleanup).
10 #include <linux/init.h>
11 #include <linux/utsname.h>
13 #include <asm/processor.h>
14 #include <asm/processor-flags.h>
17 #include <asm/paravirt.h>
18 #include <asm/alternative.h>
20 static int __init no_387(char *s)
22 boot_cpu_data.hard_math = 0;
23 write_cr0(X86_CR0_TS | X86_CR0_EM | X86_CR0_MP | read_cr0());
27 __setup("no387", no_387);
29 static double __initdata x = 4195835.0;
30 static double __initdata y = 3145727.0;
33 * This used to check for exceptions..
34 * However, it turns out that to support that,
35 * the XMM trap handlers basically had to
36 * be buggy. So let's have a correct XMM trap
37 * handler, and forget about printing out
38 * some status at boot.
40 * We should really only care about bugs here
41 * anyway. Not features.
43 static void __init check_fpu(void)
47 if (!boot_cpu_data.hard_math) {
48 #ifndef CONFIG_MATH_EMULATION
49 pr_emerg("No coprocessor found and no math emulation present\n");
50 pr_emerg("Giving up\n");
59 * trap_init() enabled FXSR and company _before_ testing for FP
62 * Test for the divl bug: http://en.wikipedia.org/wiki/Fdiv_bug
69 "fsubp %%st,%%st(1)\n\t"
74 : "m" (*&x), "m" (*&y));
79 set_cpu_bug(&boot_cpu_data, X86_BUG_FDIV);
80 pr_warn("Hmm, FPU with FDIV bug\n");
84 void __init check_bugs(void)
89 print_cpu_info(&boot_cpu_data);
93 * Check whether we are able to run this kernel safely on SMP.
95 * - i386 is no longer supported.
96 * - In order to run on anything without a TSC, we need to be
97 * compiled for a i486.
99 if (boot_cpu_data.x86 < 4)
100 panic("Kernel requires i486+ for 'invlpg' and other features");
102 init_utsname()->machine[1] =
103 '0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
104 alternative_instructions();
107 * kernel_fpu_begin/end() in check_fpu() relies on the patched
108 * alternative instructions.