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..
69 "fsubp %%st,%%st(1)\n\t"
74 : "m" (*&x
), "m" (*&y
));
78 boot_cpu_data
.fdiv_bug
= fdiv_bug
;
79 if (boot_cpu_data
.fdiv_bug
)
80 pr_warn("Hmm, FPU with FDIV bug\n");
84 * Check whether we are able to run this kernel safely on SMP.
86 * - i386 is no longer supported.
87 * - In order to run on anything without a TSC, we need to be
88 * compiled for a i486.
91 static void __init
check_config(void)
93 if (boot_cpu_data
.x86
< 4)
94 panic("Kernel requires i486+ for 'invlpg' and other features");
98 void __init
check_bugs(void)
103 print_cpu_info(&boot_cpu_data
);
106 init_utsname()->machine
[1] =
107 '0' + (boot_cpu_data
.x86
> 6 ? 6 : boot_cpu_data
.x86
);
108 alternative_instructions();
111 * kernel_fpu_begin/end() in check_fpu() relies on the patched
112 * alternative instructions.