Linux Audio

Check our new training course

Buildroot integration, development and maintenance

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