fault-nommu.c 4.5 KB

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