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>
28 #include <asm/system.h>
29 #include <asm/uaccess.h>
30 #include <asm/pgalloc.h>
31 #include <asm/pgtable.h>
32 #include <asm/hardirq.h>
33 #include <asm/mmu_context.h>
35 extern void die(const char *, struct pt_regs
*, long);
38 asmlinkage
unsigned int tlb_entry_i_dat
;
39 asmlinkage
unsigned int tlb_entry_d_dat
;
40 #define tlb_entry_i tlb_entry_i_dat
41 #define tlb_entry_d tlb_entry_d_dat
43 unsigned int tlb_entry_i_dat
[NR_CPUS
];
44 unsigned int tlb_entry_d_dat
[NR_CPUS
];
45 #define tlb_entry_i tlb_entry_i_dat[smp_processor_id()]
46 #define tlb_entry_d tlb_entry_d_dat[smp_processor_id()]
50 * Unlock any spinlocks which will prevent us from getting the
53 void bust_spinlocks(int yes
)
55 int loglevel_save
= console_loglevel
;
66 * OK, the message is on the console. Now we call printk()
67 * without oops_in_progress set so that printk will give klogd
68 * a poke. Hold onto your hats...
70 console_loglevel
= 15; /* NMI oopser may have shut the console up */
72 console_loglevel
= loglevel_save
;
75 void do_BUG(const char *file
, int line
)
78 printk("kernel BUG at %s:%d!\n", file
, line
);
81 /*======================================================================*
83 *======================================================================*
84 * This routine handles page faults. It determines the address,
85 * and the problem, and then passes it off to one of the appropriate
90 * error_code : See below
91 * address : M32R MMU MDEVA reg. (Operand ACE)
92 * : M32R BPC reg. (Instruction ACE)
95 * bit 0 == 0 means no page found, 1 means protection fault
96 * bit 1 == 0 means read, 1 means write
97 * bit 2 == 0 means kernel, 1 means user-mode
98 *======================================================================*/
99 asmlinkage
void do_page_fault(struct pt_regs
*regs
, unsigned long error_code
,
100 unsigned long address
)
104 * Oops. The kernel tried to access some bad page. We'll have to
105 * terminate things with extreme prejudice.
110 if (address
< PAGE_SIZE
)
111 printk(KERN_ALERT
"Unable to handle kernel NULL pointer dereference");
113 printk(KERN_ALERT
"Unable to handle kernel paging request");
114 printk(" at virtual address %08lx\n",address
);
115 printk(" printing bpc:\n");
116 printk(KERN_ALERT
"bpc = %08lx\n", regs
->bpc
);
118 die("Oops", regs
, error_code
);
123 /*======================================================================*
125 *======================================================================*/
126 void update_mmu_cache(struct vm_area_struct
*vma
, unsigned long addr
,
132 /*======================================================================*
133 * flush_tlb_page() : flushes one page
134 *======================================================================*/
135 void local_flush_tlb_page(struct vm_area_struct
*vma
, unsigned long page
)
140 /*======================================================================*
141 * flush_tlb_range() : flushes a range of pages
142 *======================================================================*/
143 void local_flush_tlb_range(struct vm_area_struct
*vma
, unsigned long start
,
149 /*======================================================================*
150 * flush_tlb_mm() : flushes the specified mm context TLB's
151 *======================================================================*/
152 void local_flush_tlb_mm(struct mm_struct
*mm
)
157 /*======================================================================*
158 * flush_tlb_all() : flushes all processes TLBs
159 *======================================================================*/
160 void local_flush_tlb_all(void)