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