diff options
Diffstat (limited to 'arch/m32r/mm/fault-nommu.c')
-rw-r--r-- | arch/m32r/mm/fault-nommu.c | 165 |
1 files changed, 165 insertions, 0 deletions
diff --git a/arch/m32r/mm/fault-nommu.c b/arch/m32r/mm/fault-nommu.c new file mode 100644 index 000000000000..d9d488d782e8 --- /dev/null +++ b/arch/m32r/mm/fault-nommu.c | |||
@@ -0,0 +1,165 @@ | |||
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 | |||
10 | /* $Id: fault-nommu.c,v 1.1 2004/03/30 06:40:59 sakugawa Exp $ */ | ||
11 | |||
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> | ||
21 | #include <linux/mm.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() */ | ||
27 | |||
28 | #include <asm/m32r.h> | ||
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> | ||
35 | |||
36 | extern void die(const char *, struct pt_regs *, long); | ||
37 | |||
38 | #ifndef CONFIG_SMP | ||
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 | ||
43 | #else | ||
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()] | ||
48 | #endif | ||
49 | |||
50 | /* | ||
51 | * Unlock any spinlocks which will prevent us from getting the | ||
52 | * message out | ||
53 | */ | ||
54 | void bust_spinlocks(int yes) | ||
55 | { | ||
56 | int loglevel_save = console_loglevel; | ||
57 | |||
58 | if (yes) { | ||
59 | oops_in_progress = 1; | ||
60 | return; | ||
61 | } | ||
62 | #ifdef CONFIG_VT | ||
63 | unblank_screen(); | ||
64 | #endif | ||
65 | oops_in_progress = 0; | ||
66 | /* | ||
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... | ||
70 | */ | ||
71 | console_loglevel = 15; /* NMI oopser may have shut the console up */ | ||
72 | printk(" "); | ||
73 | console_loglevel = loglevel_save; | ||
74 | } | ||
75 | |||
76 | void do_BUG(const char *file, int line) | ||
77 | { | ||
78 | bust_spinlocks(1); | ||
79 | printk("kernel BUG at %s:%d!\n", file, line); | ||
80 | } | ||
81 | |||
82 | /*======================================================================* | ||
83 | * do_page_fault() | ||
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 | ||
87 | * routines. | ||
88 | * | ||
89 | * ARGUMENT: | ||
90 | * regs : M32R SP reg. | ||
91 | * error_code : See below | ||
92 | * address : M32R MMU MDEVA reg. (Operand ACE) | ||
93 | * : M32R BPC reg. (Instruction ACE) | ||
94 | * | ||
95 | * error_code : | ||
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) | ||
102 | { | ||
103 | |||
104 | /* | ||
105 | * Oops. The kernel tried to access some bad page. We'll have to | ||
106 | * terminate things with extreme prejudice. | ||
107 | */ | ||
108 | |||
109 | bust_spinlocks(1); | ||
110 | |||
111 | if (address < PAGE_SIZE) | ||
112 | printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); | ||
113 | else | ||
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); | ||
118 | |||
119 | die("Oops", regs, error_code); | ||
120 | bust_spinlocks(0); | ||
121 | do_exit(SIGKILL); | ||
122 | } | ||
123 | |||
124 | /*======================================================================* | ||
125 | * update_mmu_cache() | ||
126 | *======================================================================*/ | ||
127 | void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, | ||
128 | pte_t pte) | ||
129 | { | ||
130 | BUG(); | ||
131 | } | ||
132 | |||
133 | /*======================================================================* | ||
134 | * flush_tlb_page() : flushes one page | ||
135 | *======================================================================*/ | ||
136 | void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) | ||
137 | { | ||
138 | BUG(); | ||
139 | } | ||
140 | |||
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, | ||
145 | unsigned long end) | ||
146 | { | ||
147 | BUG(); | ||
148 | } | ||
149 | |||
150 | /*======================================================================* | ||
151 | * flush_tlb_mm() : flushes the specified mm context TLB's | ||
152 | *======================================================================*/ | ||
153 | void local_flush_tlb_mm(struct mm_struct *mm) | ||
154 | { | ||
155 | BUG(); | ||
156 | } | ||
157 | |||
158 | /*======================================================================* | ||
159 | * flush_tlb_all() : flushes all processes TLBs | ||
160 | *======================================================================*/ | ||
161 | void local_flush_tlb_all(void) | ||
162 | { | ||
163 | BUG(); | ||
164 | } | ||
165 | |||