Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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