Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / sh / mm / fault-nommu.c
blob34d4e0c68fbb10e713699214214e47029584e9fb
1 /*
2 * arch/sh/mm/fault-nommu.c
4 * Copyright (C) 2002 Paul Mundt
6 * Based on linux/arch/sh/mm/fault.c:
7 * Copyright (C) 1999 Niibe Yutaka
9 * Released under the terms of the GNU GPL v2.0.
12 #include <linux/signal.h>
13 #include <linux/sched.h>
14 #include <linux/kernel.h>
15 #include <linux/errno.h>
16 #include <linux/string.h>
17 #include <linux/types.h>
18 #include <linux/ptrace.h>
19 #include <linux/mman.h>
20 #include <linux/mm.h>
21 #include <linux/smp.h>
22 #include <linux/smp_lock.h>
23 #include <linux/interrupt.h>
25 #include <asm/system.h>
26 #include <asm/io.h>
27 #include <asm/uaccess.h>
28 #include <asm/pgalloc.h>
29 #include <asm/mmu_context.h>
30 #include <asm/cacheflush.h>
32 #if defined(CONFIG_SH_KGDB)
33 #include <asm/kgdb.h>
34 #endif
36 extern void die(const char *,struct pt_regs *,long);
39 * This routine handles page faults. It determines the address,
40 * and the problem, and then passes it off to one of the appropriate
41 * routines.
43 asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
44 unsigned long address)
46 #if defined(CONFIG_SH_KGDB)
47 if (kgdb_nofault && kgdb_bus_err_hook)
48 kgdb_bus_err_hook();
49 #endif
52 * Oops. The kernel tried to access some bad page. We'll have to
53 * terminate things with extreme prejudice.
56 if (address < PAGE_SIZE) {
57 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
58 } else {
59 printk(KERN_ALERT "Unable to handle kernel paging request");
62 printk(" at virtual address %08lx\n", address);
63 printk(KERN_ALERT "pc = %08lx\n", regs->pc);
65 die("Oops", regs, writeaccess);
66 do_exit(SIGKILL);
69 asmlinkage int __do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
70 unsigned long address)
72 #if defined(CONFIG_SH_KGDB)
73 if (kgdb_nofault && kgdb_bus_err_hook)
74 kgdb_bus_err_hook();
75 #endif
77 if (address >= TASK_SIZE)
78 return 1;
80 return 0;