fault-nommu.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. /*
  43. * Unlock any spinlocks which will prevent us from getting the
  44. * message out
  45. */
  46. void bust_spinlocks(int yes)
  47. {
  48. int loglevel_save = console_loglevel;
  49. if (yes) {
  50. oops_in_progress = 1;
  51. return;
  52. }
  53. #ifdef CONFIG_VT
  54. unblank_screen();
  55. #endif
  56. oops_in_progress = 0;
  57. /*
  58. * OK, the message is on the console. Now we call printk()
  59. * without oops_in_progress set so that printk will give klogd
  60. * a poke. Hold onto your hats...
  61. */
  62. console_loglevel = 15; /* NMI oopser may have shut the console up */
  63. printk(" ");
  64. console_loglevel = loglevel_save;
  65. }
  66. void do_BUG(const char *file, int line)
  67. {
  68. bust_spinlocks(1);
  69. printk("kernel BUG at %s:%d!\n", file, line);
  70. }
  71. /*======================================================================*
  72. * do_page_fault()
  73. *======================================================================*
  74. * This routine handles page faults. It determines the address,
  75. * and the problem, and then passes it off to one of the appropriate
  76. * routines.
  77. *
  78. * ARGUMENT:
  79. * regs : M32R SP reg.
  80. * error_code : See below
  81. * address : M32R MMU MDEVA reg. (Operand ACE)
  82. * : M32R BPC reg. (Instruction ACE)
  83. *
  84. * error_code :
  85. * bit 0 == 0 means no page found, 1 means protection fault
  86. * bit 1 == 0 means read, 1 means write
  87. * bit 2 == 0 means kernel, 1 means user-mode
  88. *======================================================================*/
  89. asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code,
  90. unsigned long address)
  91. {
  92. /*
  93. * Oops. The kernel tried to access some bad page. We'll have to
  94. * terminate things with extreme prejudice.
  95. */
  96. bust_spinlocks(1);
  97. if (address < PAGE_SIZE)
  98. printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
  99. else
  100. printk(KERN_ALERT "Unable to handle kernel paging request");
  101. printk(" at virtual address %08lx\n",address);
  102. printk(" printing bpc:\n");
  103. printk(KERN_ALERT "bpc = %08lx\n", regs->bpc);
  104. die("Oops", regs, error_code);
  105. bust_spinlocks(0);
  106. do_exit(SIGKILL);
  107. }
  108. /*======================================================================*
  109. * update_mmu_cache()
  110. *======================================================================*/
  111. void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
  112. pte_t pte)
  113. {
  114. BUG();
  115. }
  116. /*======================================================================*
  117. * flush_tlb_page() : flushes one page
  118. *======================================================================*/
  119. void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
  120. {
  121. BUG();
  122. }
  123. /*======================================================================*
  124. * flush_tlb_range() : flushes a range of pages
  125. *======================================================================*/
  126. void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
  127. unsigned long end)
  128. {
  129. BUG();
  130. }
  131. /*======================================================================*
  132. * flush_tlb_mm() : flushes the specified mm context TLB's
  133. *======================================================================*/
  134. void local_flush_tlb_mm(struct mm_struct *mm)
  135. {
  136. BUG();
  137. }
  138. /*======================================================================*
  139. * flush_tlb_all() : flushes all processes TLBs
  140. *======================================================================*/
  141. void local_flush_tlb_all(void)
  142. {
  143. BUG();
  144. }