2 * linux/arch/m32r/mm/fault.c
4 * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo
6 * Some code taken from i386 version.
7 * Copyright (C) 1995 Linus Torvalds
10 /* $Id: fault-nommu.c,v 1.1 2004/03/30 06:40:59 sakugawa Exp $ */
12 #include <linux/config.h>
13 #include <linux/signal.h>
14 #include <linux/sched.h>
15 #include <linux/kernel.h>
16 #include <linux/errno.h>
17 #include <linux/string.h>
18 #include <linux/types.h>
19 #include <linux/ptrace.h>
20 #include <linux/mman.h>
22 #include <linux/smp.h>
23 #include <linux/smp_lock.h>
24 #include <linux/interrupt.h>
25 #include <linux/init.h>
26 #include <linux/vt_kern.h> /* For unblank_screen() */
29 #include <asm/system.h>
30 #include <asm/uaccess.h>
31 #include <asm/pgalloc.h>
32 #include <asm/pgtable.h>
33 #include <asm/hardirq.h>
34 #include <asm/mmu_context.h>
36 extern void die(const char *, struct pt_regs
*, long);
39 asmlinkage
unsigned int tlb_entry_i_dat
;
40 asmlinkage
unsigned int tlb_entry_d_dat
;
41 #define tlb_entry_i tlb_entry_i_dat
42 #define tlb_entry_d tlb_entry_d_dat
44 unsigned int tlb_entry_i_dat
[NR_CPUS
];
45 unsigned int tlb_entry_d_dat
[NR_CPUS
];
46 #define tlb_entry_i tlb_entry_i_dat[smp_processor_id()]
47 #define tlb_entry_d tlb_entry_d_dat[smp_processor_id()]
51 * Unlock any spinlocks which will prevent us from getting the
54 void bust_spinlocks(int yes
)
56 int loglevel_save
= console_loglevel
;
67 * OK, the message is on the console. Now we call printk()
68 * without oops_in_progress set so that printk will give klogd
69 * a poke. Hold onto your hats...
71 console_loglevel
= 15; /* NMI oopser may have shut the console up */
73 console_loglevel
= loglevel_save
;
76 void do_BUG(const char *file
, int line
)
79 printk("kernel BUG at %s:%d!\n", file
, line
);
82 /*======================================================================*
84 *======================================================================*
85 * This routine handles page faults. It determines the address,
86 * and the problem, and then passes it off to one of the appropriate
91 * error_code : See below
92 * address : M32R MMU MDEVA reg. (Operand ACE)
93 * : M32R BPC reg. (Instruction ACE)
96 * bit 0 == 0 means no page found, 1 means protection fault
97 * bit 1 == 0 means read, 1 means write
98 * bit 2 == 0 means kernel, 1 means user-mode
99 *======================================================================*/
100 asmlinkage
void do_page_fault(struct pt_regs
*regs
, unsigned long error_code
,
101 unsigned long address
)
105 * Oops. The kernel tried to access some bad page. We'll have to
106 * terminate things with extreme prejudice.
111 if (address
< PAGE_SIZE
)
112 printk(KERN_ALERT
"Unable to handle kernel NULL pointer dereference");
114 printk(KERN_ALERT
"Unable to handle kernel paging request");
115 printk(" at virtual address %08lx\n",address
);
116 printk(" printing bpc:\n");
117 printk(KERN_ALERT
"bpc = %08lx\n", regs
->bpc
);
119 die("Oops", regs
, error_code
);
124 /*======================================================================*
126 *======================================================================*/
127 void update_mmu_cache(struct vm_area_struct
*vma
, unsigned long addr
,
133 /*======================================================================*
134 * flush_tlb_page() : flushes one page
135 *======================================================================*/
136 void local_flush_tlb_page(struct vm_area_struct
*vma
, unsigned long page
)
141 /*======================================================================*
142 * flush_tlb_range() : flushes a range of pages
143 *======================================================================*/
144 void local_flush_tlb_range(struct vm_area_struct
*vma
, unsigned long start
,
150 /*======================================================================*
151 * flush_tlb_mm() : flushes the specified mm context TLB's
152 *======================================================================*/
153 void local_flush_tlb_mm(struct mm_struct
*mm
)
158 /*======================================================================*
159 * flush_tlb_all() : flushes all processes TLBs
160 *======================================================================*/
161 void local_flush_tlb_all(void)