/*1* linux/arch/h8300/mm/fault.c2*3* Copyright (C) 1998 D. Jeff Dionne <[email protected]>,4* Copyright (C) 2000 Lineo, Inc. (www.lineo.com)5*6* Based on:7*8* linux/arch/m68knommu/mm/fault.c9* linux/arch/m68k/mm/fault.c10*11* Copyright (C) 1995 Hamish Macdonald12*/1314#include <linux/mman.h>15#include <linux/mm.h>16#include <linux/kernel.h>17#include <linux/ptrace.h>1819#include <asm/system.h>20#include <asm/pgtable.h>2122/*23* This routine handles page faults. It determines the problem, and24* 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 fault28* bit 1 == 0 means read, 1 means write29*30* If this routine detects a bad access, it returns 1, otherwise it31* returns 0.32*/33asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,34unsigned long error_code)35{36#ifdef DEBUG37printk ("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n",38regs->sr, regs->pc, address, error_code);39#endif4041/*42* Oops. The kernel tried to access some bad page. We'll have to43* terminate things with extreme prejudice.44*/45if ((unsigned long) address < PAGE_SIZE) {46printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");47} else48printk(KERN_ALERT "Unable to handle kernel access");49printk(" at virtual address %08lx\n",address);50if (!user_mode(regs))51die("Oops", regs, error_code);52do_exit(SIGKILL);5354return 1;55}56575859