fault-nommu.c 3.9 KB

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