fault-nommu.c 1.8 KB

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