blob: 923cb456819b0ceb79f3c66139602a45ae4f8232 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * arch/sh/mm/fault-nommu.c
3 *
4 * Copyright (C) 2002 Paul Mundt
5 *
6 * Based on linux/arch/sh/mm/fault.c:
7 * Copyright (C) 1999 Niibe Yutaka
8 *
9 * Released under the terms of the GNU GPL v2.0.
10 */
11
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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/interrupt.h>
23
24#include <asm/system.h>
25#include <asm/io.h>
26#include <asm/uaccess.h>
27#include <asm/pgalloc.h>
28#include <asm/mmu_context.h>
29#include <asm/cacheflush.h>
30
31#if defined(CONFIG_SH_KGDB)
32#include <asm/kgdb.h>
33#endif
34
35extern void die(const char *,struct pt_regs *,long);
36
37/*
38 * This routine handles page faults. It determines the address,
39 * and the problem, and then passes it off to one of the appropriate
40 * routines.
41 */
42asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
43 unsigned long address)
44{
45#if defined(CONFIG_SH_KGDB)
46 if (kgdb_nofault && kgdb_bus_err_hook)
47 kgdb_bus_err_hook();
48#endif
49
50 /*
51 * Oops. The kernel tried to access some bad page. We'll have to
52 * terminate things with extreme prejudice.
53 *
54 */
55 if (address < PAGE_SIZE) {
56 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
57 } else {
58 printk(KERN_ALERT "Unable to handle kernel paging request");
59 }
60
61 printk(" at virtual address %08lx\n", address);
62 printk(KERN_ALERT "pc = %08lx\n", regs->pc);
63
64 die("Oops", regs, writeaccess);
65 do_exit(SIGKILL);
66}
67
68asmlinkage int __do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
69 unsigned long address)
70{
71#if defined(CONFIG_SH_KGDB)
72 if (kgdb_nofault && kgdb_bus_err_hook)
73 kgdb_bus_err_hook();
74#endif
75
76 if (address >= TASK_SIZE)
77 return 1;
78
79 return 0;
80}
81