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 #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>
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() */
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>
33 extern void die(const char *, struct pt_regs
*, long);
36 asmlinkage
unsigned int tlb_entry_i_dat
;
37 asmlinkage
unsigned int tlb_entry_d_dat
;
38 #define tlb_entry_i tlb_entry_i_dat
39 #define tlb_entry_d tlb_entry_d_dat
41 unsigned int tlb_entry_i_dat
[NR_CPUS
];
42 unsigned int tlb_entry_d_dat
[NR_CPUS
];
43 #define tlb_entry_i tlb_entry_i_dat[smp_processor_id()]
44 #define tlb_entry_d tlb_entry_d_dat[smp_processor_id()]
47 void do_BUG(const char *file
, int line
)
50 printk("kernel BUG at %s:%d!\n", file
, line
);
53 /*======================================================================*
55 *======================================================================*
56 * This routine handles page faults. It determines the address,
57 * and the problem, and then passes it off to one of the appropriate
62 * error_code : See below
63 * address : M32R MMU MDEVA reg. (Operand ACE)
64 * : M32R BPC reg. (Instruction ACE)
67 * bit 0 == 0 means no page found, 1 means protection fault
68 * bit 1 == 0 means read, 1 means write
69 * bit 2 == 0 means kernel, 1 means user-mode
70 *======================================================================*/
71 asmlinkage
void do_page_fault(struct pt_regs
*regs
, unsigned long error_code
,
72 unsigned long address
)
76 * Oops. The kernel tried to access some bad page. We'll have to
77 * terminate things with extreme prejudice.
82 if (address
< PAGE_SIZE
)
83 printk(KERN_ALERT
"Unable to handle kernel NULL pointer dereference");
85 printk(KERN_ALERT
"Unable to handle kernel paging request");
86 printk(" at virtual address %08lx\n",address
);
87 printk(" printing bpc:\n");
88 printk(KERN_ALERT
"bpc = %08lx\n", regs
->bpc
);
90 die("Oops", regs
, error_code
);
95 /*======================================================================*
97 *======================================================================*/
98 void update_mmu_cache(struct vm_area_struct
*vma
, unsigned long addr
,
104 /*======================================================================*
105 * flush_tlb_page() : flushes one page
106 *======================================================================*/
107 void local_flush_tlb_page(struct vm_area_struct
*vma
, unsigned long page
)
112 /*======================================================================*
113 * flush_tlb_range() : flushes a range of pages
114 *======================================================================*/
115 void local_flush_tlb_range(struct vm_area_struct
*vma
, unsigned long start
,
121 /*======================================================================*
122 * flush_tlb_mm() : flushes the specified mm context TLB's
123 *======================================================================*/
124 void local_flush_tlb_mm(struct mm_struct
*mm
)
129 /*======================================================================*
130 * flush_tlb_all() : flushes all processes TLBs
131 *======================================================================*/
132 void local_flush_tlb_all(void)