MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / arch / m32r / mm / fault-nommu.c
blobda267d843acfdcf6bb447c90683104169ef970fe
1 /*
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
8 */
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>
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>
27 #include <asm/m32r.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);
37 #ifndef CONFIG_SMP
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
42 #else
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()]
47 #endif
50 * Unlock any spinlocks which will prevent us from getting the
51 * message out
53 void bust_spinlocks(int yes)
55 int loglevel_save = console_loglevel;
57 if (yes) {
58 oops_in_progress = 1;
59 return;
61 #ifdef CONFIG_VT
62 unblank_screen();
63 #endif
64 oops_in_progress = 0;
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 */
71 printk(" ");
72 console_loglevel = loglevel_save;
75 void do_BUG(const char *file, int line)
77 bust_spinlocks(1);
78 printk("kernel BUG at %s:%d!\n", file, line);
81 /*======================================================================*
82 * do_page_fault()
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
86 * routines.
88 * ARGUMENT:
89 * regs : M32R SP reg.
90 * error_code : See below
91 * address : M32R MMU MDEVA reg. (Operand ACE)
92 * : M32R BPC reg. (Instruction ACE)
94 * error_code :
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.
108 bust_spinlocks(1);
110 if (address < PAGE_SIZE)
111 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
112 else
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);
119 bust_spinlocks(0);
120 do_exit(SIGKILL);
123 /*======================================================================*
124 * update_mmu_cache()
125 *======================================================================*/
126 void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr,
127 pte_t pte)
129 BUG();
132 /*======================================================================*
133 * flush_tlb_page() : flushes one page
134 *======================================================================*/
135 void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
137 BUG();
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,
144 unsigned long end)
146 BUG();
149 /*======================================================================*
150 * flush_tlb_mm() : flushes the specified mm context TLB's
151 *======================================================================*/
152 void local_flush_tlb_mm(struct mm_struct *mm)
154 BUG();
157 /*======================================================================*
158 * flush_tlb_all() : flushes all processes TLBs
159 *======================================================================*/
160 void local_flush_tlb_all(void)
162 BUG();