~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/kernel/cpu/bugs.c

Version: ~ [ linux-5.2 ] ~ [ linux-5.1.16 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.57 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.132 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.184 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.184 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.69 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  Copyright (C) 1994  Linus Torvalds
  3  *
  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).
  9  */
 10 #include <linux/init.h>
 11 #include <linux/utsname.h>
 12 #include <asm/bugs.h>
 13 #include <asm/processor.h>
 14 #include <asm/processor-flags.h>
 15 #include <asm/i387.h>
 16 #include <asm/msr.h>
 17 #include <asm/paravirt.h>
 18 #include <asm/alternative.h>
 19 
 20 static double __initdata x = 4195835.0;
 21 static double __initdata y = 3145727.0;
 22 
 23 /*
 24  * This used to check for exceptions..
 25  * However, it turns out that to support that,
 26  * the XMM trap handlers basically had to
 27  * be buggy. So let's have a correct XMM trap
 28  * handler, and forget about printing out
 29  * some status at boot.
 30  *
 31  * We should really only care about bugs here
 32  * anyway. Not features.
 33  */
 34 static void __init check_fpu(void)
 35 {
 36         s32 fdiv_bug;
 37 
 38         kernel_fpu_begin();
 39 
 40         /*
 41          * trap_init() enabled FXSR and company _before_ testing for FP
 42          * problems here.
 43          *
 44          * Test for the divl bug: http://en.wikipedia.org/wiki/Fdiv_bug
 45          */
 46         __asm__("fninit\n\t"
 47                 "fldl %1\n\t"
 48                 "fdivl %2\n\t"
 49                 "fmull %2\n\t"
 50                 "fldl %1\n\t"
 51                 "fsubp %%st,%%st(1)\n\t"
 52                 "fistpl %0\n\t"
 53                 "fwait\n\t"
 54                 "fninit"
 55                 : "=m" (*&fdiv_bug)
 56                 : "m" (*&x), "m" (*&y));
 57 
 58         kernel_fpu_end();
 59 
 60         if (fdiv_bug) {
 61                 set_cpu_bug(&boot_cpu_data, X86_BUG_FDIV);
 62                 pr_warn("Hmm, FPU with FDIV bug\n");
 63         }
 64 }
 65 
 66 void __init check_bugs(void)
 67 {
 68         identify_boot_cpu();
 69 #ifndef CONFIG_SMP
 70         pr_info("CPU: ");
 71         print_cpu_info(&boot_cpu_data);
 72 #endif
 73 
 74         /*
 75          * Check whether we are able to run this kernel safely on SMP.
 76          *
 77          * - i386 is no longer supported.
 78          * - In order to run on anything without a TSC, we need to be
 79          *   compiled for a i486.
 80          */
 81         if (boot_cpu_data.x86 < 4)
 82                 panic("Kernel requires i486+ for 'invlpg' and other features");
 83 
 84         init_utsname()->machine[1] =
 85                 '' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);
 86         alternative_instructions();
 87 
 88         /*
 89          * kernel_fpu_begin/end() in check_fpu() relies on the patched
 90          * alternative instructions.
 91          */
 92         if (cpu_has_fpu)
 93                 check_fpu();
 94 }
 95 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp