Linux 5.7.6
[linux/fpc-iii.git] / arch / h8300 / mm / fault.c
blobfabffb83930af24e214d27637eb90deb976492d0
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * linux/arch/h8300/mm/fault.c
5 * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>,
6 * Copyright (C) 2000 Lineo, Inc. (www.lineo.com)
8 * Based on:
10 * linux/arch/m68knommu/mm/fault.c
11 * linux/arch/m68k/mm/fault.c
13 * Copyright (C) 1995 Hamish Macdonald
16 #include <linux/mman.h>
17 #include <linux/mm.h>
18 #include <linux/kernel.h>
19 #include <linux/ptrace.h>
21 #include <asm/pgtable.h>
23 void die(const char *str, struct pt_regs *fp, unsigned long err);
26 * This routine handles page faults. It determines the problem, and
27 * then passes it off to one of the appropriate routines.
29 * error_code:
30 * bit 0 == 0 means no page found, 1 means protection fault
31 * bit 1 == 0 means read, 1 means write
33 * If this routine detects a bad access, it returns 1, otherwise it
34 * returns 0.
36 asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
37 unsigned long error_code)
39 #ifdef DEBUG
40 pr_debug("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n",
41 regs->sr, regs->pc, address, error_code);
42 #endif
45 * Oops. The kernel tried to access some bad page. We'll have to
46 * terminate things with extreme prejudice.
48 if ((unsigned long) address < PAGE_SIZE)
49 pr_alert("Unable to handle kernel NULL pointer dereference");
50 else
51 pr_alert("Unable to handle kernel access");
52 printk(" at virtual address %08lx\n", address);
53 if (!user_mode(regs))
54 die("Oops", regs, error_code);
55 do_exit(SIGKILL);
57 return 1;