fault-nommu.c 4.5 KB

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