2 * arch/ubicom32/mm/fault.c
3 * Ubicom32 architecture page fault implementation.
5 * (C) Copyright 2009, Ubicom, Inc.
6 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
7 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
11 * linux/arch/m68k/mm/fault.c
13 * Copyright (C) 1995 Hamish Macdonald
15 * This file is part of the Ubicom32 Linux Kernel Port.
17 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
18 * it and/or modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation, either version 2 of the
20 * License, or (at your option) any later version.
22 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
23 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
24 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
25 * the GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with the Ubicom32 Linux Kernel Port. If not,
29 * see <http://www.gnu.org/licenses/>.
31 * Ubicom32 implementation derived from (with many thanks):
37 #include <linux/module.h>
38 #include <linux/mman.h>
40 #include <linux/kernel.h>
41 #include <linux/ptrace.h>
43 #include <asm/system.h>
44 #include <asm/pgtable.h>
46 extern void die_if_kernel(char *, struct pt_regs *, long);
49 * This routine handles page faults. It determines the problem, and
50 * then passes it off to one of the appropriate routines.
53 * bit 0 == 0 means no page found, 1 means protection fault
54 * bit 1 == 0 means read, 1 means write
56 * If this routine detects a bad access, it returns 1, otherwise it
59 asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
60 unsigned long error_code)
63 printk (KERN_DEBUG "regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n",
64 regs->sr, regs->pc, address, error_code);
68 * Oops. The kernel tried to access some bad page. We'll have to
69 * terminate things with extreme prejudice.
71 if ((unsigned long) address < PAGE_SIZE) {
72 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
74 printk(KERN_ALERT "Unable to handle kernel access");
75 printk(KERN_ALERT " at virtual address %08lx\n",address);
76 die_if_kernel("Oops", regs, error_code);