extable.c 793 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * linux/arch/i386/mm/extable.c
  3. */
  4. #include <linux/config.h>
  5. #include <linux/module.h>
  6. #include <linux/spinlock.h>
  7. #include <asm/uaccess.h>
  8. int fixup_exception(struct pt_regs *regs)
  9. {
  10. const struct exception_table_entry *fixup;
  11. #ifdef CONFIG_PNPBIOS
  12. if (unlikely((regs->xcs & ~15) == (GDT_ENTRY_PNPBIOS_BASE << 3)))
  13. {
  14. extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp;
  15. extern u32 pnp_bios_is_utter_crap;
  16. pnp_bios_is_utter_crap = 1;
  17. printk(KERN_CRIT "PNPBIOS fault.. attempting recovery.\n");
  18. __asm__ volatile(
  19. "movl %0, %%esp\n\t"
  20. "jmp *%1\n\t"
  21. : : "g" (pnp_bios_fault_esp), "g" (pnp_bios_fault_eip));
  22. panic("do_trap: can't hit this");
  23. }
  24. #endif
  25. fixup = search_exception_tables(regs->eip);
  26. if (fixup) {
  27. regs->eip = fixup->fixup;
  28. return 1;
  29. }
  30. return 0;
  31. }