blob: 472535977006b6405bed220f658c0aae9d32f5b0 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/h8300/mm/fault.c
3 *
4 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
5 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
6 *
7 * Based on:
8 *
9 * linux/arch/m68knommu/mm/fault.c
10 * linux/arch/m68k/mm/fault.c
11 *
12 * Copyright (C) 1995 Hamish Macdonald
13 */
14
15#include <linux/mman.h>
16#include <linux/mm.h>
17#include <linux/kernel.h>
18#include <linux/ptrace.h>
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/pgtable.h>
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022/*
23 * This routine handles page faults. It determines the problem, and
24 * then passes it off to one of the appropriate routines.
25 *
26 * error_code:
27 * bit 0 == 0 means no page found, 1 means protection fault
28 * bit 1 == 0 means read, 1 means write
29 *
30 * If this routine detects a bad access, it returns 1, otherwise it
31 * returns 0.
32 */
33asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
34 unsigned long error_code)
35{
36#ifdef DEBUG
37 printk ("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n",
38 regs->sr, regs->pc, address, error_code);
39#endif
40
41/*
42 * Oops. The kernel tried to access some bad page. We'll have to
43 * terminate things with extreme prejudice.
44 */
45 if ((unsigned long) address < PAGE_SIZE) {
46 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
47 } else
48 printk(KERN_ALERT "Unable to handle kernel access");
49 printk(" at virtual address %08lx\n",address);
Yoshinori Sato9791af52008-10-15 22:01:17 -070050 if (!user_mode(regs))
51 die("Oops", regs, error_code);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 do_exit(SIGKILL);
53
54 return 1;
55}
56