fault-nommu.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * arch/sh/mm/fault-nommu.c
  3. *
  4. * Copyright (C) 2002 - 2007 Paul Mundt
  5. *
  6. * Based on linux/arch/sh/mm/fault.c:
  7. * Copyright (C) 1999 Niibe Yutaka
  8. *
  9. * Released under the terms of the GNU GPL v2.0.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/mm.h>
  13. #include <linux/hardirq.h>
  14. #include <linux/kprobes.h>
  15. #include <asm/system.h>
  16. #include <asm/ptrace.h>
  17. #include <asm/kgdb.h>
  18. /*
  19. * This routine handles page faults. It determines the address,
  20. * and the problem, and then passes it off to one of the appropriate
  21. * routines.
  22. */
  23. asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
  24. unsigned long writeaccess,
  25. unsigned long address)
  26. {
  27. trace_hardirqs_on();
  28. local_irq_enable();
  29. #if defined(CONFIG_SH_KGDB)
  30. if (kgdb_nofault && kgdb_bus_err_hook)
  31. kgdb_bus_err_hook();
  32. #endif
  33. /*
  34. * Oops. The kernel tried to access some bad page. We'll have to
  35. * terminate things with extreme prejudice.
  36. *
  37. */
  38. if (address < PAGE_SIZE) {
  39. printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
  40. } else {
  41. printk(KERN_ALERT "Unable to handle kernel paging request");
  42. }
  43. printk(" at virtual address %08lx\n", address);
  44. printk(KERN_ALERT "pc = %08lx\n", regs->pc);
  45. die("Oops", regs, writeaccess);
  46. do_exit(SIGKILL);
  47. }
  48. asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
  49. unsigned long writeaccess,
  50. unsigned long address)
  51. {
  52. #if defined(CONFIG_SH_KGDB)
  53. if (kgdb_nofault && kgdb_bus_err_hook)
  54. kgdb_bus_err_hook();
  55. #endif
  56. return (address >= TASK_SIZE);
  57. }