]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix panic if pnpbios is enabled and speed up its check in
authorLuca Barbieri <ldb@ldb.ods.org>
Sat, 31 Aug 2002 03:21:42 +0000 (20:21 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sat, 31 Aug 2002 03:21:42 +0000 (20:21 -0700)
This fixes the pnpbios CS check to check for the correct values (it
wasn't up to date with the various GDT reshuffles), moves it inside the
kernel mode check, modifies it so that it takes less instructions and
marks it with unlikely().

Note that the 2.5.32 version of this check will cause the kernel to
always panic since it checks for the kernel segments and will thus
decide to jump to the pnpbios fault handler without being in pnpbios.
pnpbios_core.c instead seems to use the correct values.

arch/i386/kernel/traps.c

index 7a6ae732bfc98bf1c5080f38a698d5338b5528cf..032514876dc3c0f4332e71b85029dca65f705803 100644 (file)
@@ -311,21 +311,6 @@ static void inline do_trap(int trapnr, int signr, char *str, int vm86,
        if (vm86 && regs->eflags & VM_MASK)
                goto vm86_trap;
 
-#ifdef CONFIG_PNPBIOS          
-       if (regs->xcs == 0x60 || regs->xcs == 0x68)
-       {
-               extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp;
-               extern u32 pnp_bios_is_utter_crap;
-               pnp_bios_is_utter_crap = 1;
-               printk(KERN_CRIT "PNPBIOS fault.. attempting recovery.\n");
-               __asm__ volatile(
-                       "movl %0, %%esp\n\t"
-                       "jmp *%1\n\t"
-                       : "=a" (pnp_bios_fault_esp), "=b" (pnp_bios_fault_eip));
-               panic("do_trap: can't hit this");
-       }
-#endif 
-
        if (!(regs->xcs & 3))
                goto kernel_trap;
 
@@ -341,7 +326,23 @@ static void inline do_trap(int trapnr, int signr, char *str, int vm86,
        }
 
        kernel_trap: {
-               unsigned long fixup = search_exception_table(regs->eip);
+               unsigned long fixup;
+#ifdef CONFIG_PNPBIOS
+               if (unlikely((regs->xcs | 8) == 0x88)) /* 0x80 or 0x88 */
+               {
+                       extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp;
+                       extern u32 pnp_bios_is_utter_crap;
+                       pnp_bios_is_utter_crap = 1;
+                       printk(KERN_CRIT "PNPBIOS fault.. attempting recovery.\n");
+                       __asm__ volatile(
+                               "movl %0, %%esp\n\t"
+                               "jmp *%1\n\t"
+                               : "=a" (pnp_bios_fault_esp), "=b" (pnp_bios_fault_eip));
+                       panic("do_trap: can't hit this");
+               }
+#endif 
+               
+               fixup = search_exception_table(regs->eip);
                if (fixup)
                        regs->eip = fixup;
                else