fault-nommu.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. * linux/arch/m32r/mm/fault.c
  3. *
  4. * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo
  5. *
  6. * Some code taken from i386 version.
  7. * Copyright (C) 1995 Linus Torvalds
  8. */
  9. #include <linux/signal.h>
  10. #include <linux/sched.h>
  11. #include <linux/kernel.h>
  12. #include <linux/errno.h>
  13. #include <linux/string.h>
  14. #include <linux/types.h>
  15. #include <linux/ptrace.h>
  16. #include <linux/mman.h>
  17. #include <linux/mm.h>
  18. #include <linux/smp.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/init.h>
  21. #include <linux/vt_kern.h> /* For unblank_screen() */
  22. #include <asm/m32r.h>
  23. #include <asm/uaccess.h>
  24. #include <asm/pgalloc.h>
  25. #include <asm/pgtable.h>
  26. #include <asm/hardirq.h>
  27. #include <asm/mmu_context.h>
  28. extern void die(const char *, struct pt_regs *, long);
  29. #ifndef CONFIG_SMP
  30. asmlinkage unsigned int tlb_entry_i_dat;
  31. asmlinkage unsigned int tlb_entry_d_dat;
  32. #define tlb_entry_i tlb_entry_i_dat
  33. #define tlb_entry_d tlb_entry_d_dat
  34. #else
  35. unsigned int tlb_entry_i_dat[NR_CPUS];
  36. unsigned int tlb_entry_d_dat[NR_CPUS];
  37. #define tlb_entry_i tlb_entry_i_dat[smp_processor_id()]
  38. #define tlb_entry_d tlb_entry_d_dat[smp_processor_id()]
  39. #endif
  40. void do_BUG(const char *file, int line)
  41. {
  42. bust_spinlocks(1);
  43. printk("kernel BUG at %s:%d!\n", file, line);
  44. }
  45. /*======================================================================*
  46. * do_page_fault()
  47. *======================================================================*
  48. * This routine handles page faults. It determines the address,
  49. * and the problem, and then passes it off to one of the appropriate
  50. * routines.
  51. *
  52. * ARGUMENT:
  53. * regs : M32R SP reg.
  54. * error_code : See below
  55. * address : M32R MMU MDEVA reg. (Operand ACE)
  56. * : M32R BPC reg. (Instruction ACE)
  57. *
  58. * error_code :
  59. * bit 0 == 0 means no page found, 1 means protection fault
  60. * bit 1 == 0 means read, 1 means write
  61. * bit 2 == 0 means kernel, 1 means user-mode
  62. *======================================================================*/
  63. asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
  64. unsigned long address)
  65. {
  66. /*
  67. * Oops. The kernel tried to access some bad page. We'll have to
  68. * terminate things with extreme prejudice.
  69. */
  70. bust_spinlocks(1);
  71. if (address < PAGE_SIZE)
  72. printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
  73. else
  74. printk(KERN_ALERT "Unable to handle kernel paging request");
  75. printk(" at virtual address %08lx\n",address);
  76. printk(" printing bpc:\n");
  77. printk(KERN_ALERT "bpc = %08lx\n", regs->bpc);
  78. die("Oops", regs, error_code);
  79. bust_spinlocks(0);
  80. do_exit(SIGKILL);
  81. }
  82. /*======================================================================*
  83. * update_mmu_cache()
  84. *======================================================================*/
  85. void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
  86. pte_t *ptep)
  87. {
  88. BUG();
  89. }
  90. /*======================================================================*
  91. * flush_tlb_page() : flushes one page
  92. *======================================================================*/
  93. void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
  94. {
  95. BUG();
  96. }
  97. /*======================================================================*
  98. * flush_tlb_range() : flushes a range of pages
  99. *======================================================================*/
  100. void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
  101. unsigned long end)
  102. {
  103. BUG();
  104. }
  105. /*======================================================================*
  106. * flush_tlb_mm() : flushes the specified mm context TLB's
  107. *======================================================================*/
  108. void local_flush_tlb_mm(struct mm_struct *mm)
  109. {
  110. BUG();
  111. }
  112. /*======================================================================*
  113. * flush_tlb_all() : flushes all processes TLBs
  114. *======================================================================*/
  115. void local_flush_tlb_all(void)
  116. {
  117. BUG();
  118. }