fault-nommu.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * arch/sh/mm/fault-nommu.c
  3. *
  4. * Copyright (C) 2002 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/signal.h>
  12. #include <linux/sched.h>
  13. #include <linux/kernel.h>
  14. #include <linux/errno.h>
  15. #include <linux/string.h>
  16. #include <linux/types.h>
  17. #include <linux/ptrace.h>
  18. #include <linux/mman.h>
  19. #include <linux/mm.h>
  20. #include <linux/smp.h>
  21. #include <linux/smp_lock.h>
  22. #include <linux/interrupt.h>
  23. #include <asm/system.h>
  24. #include <asm/io.h>
  25. #include <asm/uaccess.h>
  26. #include <asm/pgalloc.h>
  27. #include <asm/mmu_context.h>
  28. #include <asm/cacheflush.h>
  29. #if defined(CONFIG_SH_KGDB)
  30. #include <asm/kgdb.h>
  31. #endif
  32. extern void die(const char *,struct pt_regs *,long);
  33. /*
  34. * This routine handles page faults. It determines the address,
  35. * and the problem, and then passes it off to one of the appropriate
  36. * routines.
  37. */
  38. asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
  39. unsigned long address)
  40. {
  41. #if defined(CONFIG_SH_KGDB)
  42. if (kgdb_nofault && kgdb_bus_err_hook)
  43. kgdb_bus_err_hook();
  44. #endif
  45. /*
  46. * Oops. The kernel tried to access some bad page. We'll have to
  47. * terminate things with extreme prejudice.
  48. *
  49. */
  50. if (address < PAGE_SIZE) {
  51. printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
  52. } else {
  53. printk(KERN_ALERT "Unable to handle kernel paging request");
  54. }
  55. printk(" at virtual address %08lx\n", address);
  56. printk(KERN_ALERT "pc = %08lx\n", regs->pc);
  57. die("Oops", regs, writeaccess);
  58. do_exit(SIGKILL);
  59. }
  60. asmlinkage int __do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
  61. unsigned long address)
  62. {
  63. #if defined(CONFIG_SH_KGDB)
  64. if (kgdb_nofault && kgdb_bus_err_hook)
  65. kgdb_bus_err_hook();
  66. #endif
  67. if (address >= TASK_SIZE)
  68. return 1;
  69. return 0;
  70. }