Messages in this thread Patch in this message | | | Date | Wed, 30 Jul 1997 22:29:28 +0200 | From | Pavel Machek <> | Subject | Checking of 386bugs |
| |
Hi!
I've found that file bugs.h is not properly marked with initfuncs... I also found out that it is pretty easy to test for pushad/popad bug, so I added test for it. Might be good thing, as this will remind people that their i386 is unreliable...
Pavel
[Patch against 2.1.47, should be applied in include/asm-i386]
Index: bugs.h =================================================================== RCS file: /home/pavel/cvsroot/linux/include/asm-i386/bugs.h,v retrieving revision 1.2 diff -u -r1.2 bugs.h --- bugs.h 1997/07/08 12:15:09 1.2 +++ bugs.h 1997/07/30 20:24:52 @@ -15,12 +15,12 @@ #define CONFIG_BUGi386 -static void no_halt(char *s, int *ints) +__initfunc( static void no_halt(char *s, int *ints) ) { hlt_works_ok = 0; } -static void no_387(char *s, int *ints) +__initfunc( static void no_387(char *s, int *ints) ) { hard_math = 0; __asm__("movl %%cr0,%%eax\n\t" @@ -30,7 +30,7 @@ static char fpu_error = 0; -static void copro_timeout(void) +__initfunc( static void copro_timeout(void) ) { fpu_error = 1; timer_table[COPRO_TIMER].expires = jiffies+100; @@ -41,7 +41,7 @@ outb_p(0,0xf0); } -static void check_fpu(void) +__initfunc( static void check_fpu(void) ) { static double x = 4195835.0; static double y = 3145727.0; @@ -94,12 +94,11 @@ if (!fdiv_bug) { printk("Ok, fpu using exception 16 error reporting.\n"); return; - } printk("Hmm, FDIV bug i%c86 system\n", '0'+x86); } -static void check_hlt(void) +__initfunc( static void check_hlt(void) ) { printk(KERN_INFO "Checking 'hlt' instruction... "); if (!hlt_works_ok) { @@ -110,7 +109,7 @@ printk("Ok.\n"); } -static void check_tlb(void) +__initfunc( static void check_tlb(void) ) { #ifndef CONFIG_M386 /* @@ -125,10 +124,28 @@ #endif } -static void check_bugs(void) +__initfunc( static void check_popad(void) ) +{ +#ifdef CONFIG_M386 + int res, inp = (int) &res; + + printk(KERN_INFO "Checking for popad bug..."); + __asm__ __volatile__( + "movl $12345678,%%eax; movl $0,%%edi; pusha; popa; movl (%%edx,%%edi),%%ecx " + : "=eax" (res) + : "edx" (inp) + : "eax", "ecx", "edx", "edi" ); + /* If this fails, it means that any user program may lock CPU hard. Too bad. */ + if (res != 12345678) printk( "Even worse.\n" ); + else printk( "Ok.\n" ); +#endif +} + +__initfunc( static void check_bugs(void) ) { check_tlb(); check_fpu(); check_hlt(); + check_popad(); system_utsname.machine[1] = '0' + x86; }
-- I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel Look at http://atrey.karlin.mff.cuni.cz/~pavel/ ;-).
| |