xref: /OK3568_Linux_fs/kernel/arch/ia64/mm/extable.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Kernel exception handling table support.  Derived from arch/alpha/mm/extable.c.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 1998, 1999, 2001-2002, 2004 Hewlett-Packard Co
6*4882a593Smuzhiyun  *	David Mosberger-Tang <davidm@hpl.hp.com>
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <asm/ptrace.h>
10*4882a593Smuzhiyun #include <asm/extable.h>
11*4882a593Smuzhiyun #include <asm/errno.h>
12*4882a593Smuzhiyun #include <asm/processor.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun void
ia64_handle_exception(struct pt_regs * regs,const struct exception_table_entry * e)15*4882a593Smuzhiyun ia64_handle_exception (struct pt_regs *regs, const struct exception_table_entry *e)
16*4882a593Smuzhiyun {
17*4882a593Smuzhiyun 	long fix = (u64) &e->fixup + e->fixup;
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun 	regs->r8 = -EFAULT;
20*4882a593Smuzhiyun 	if (fix & 4)
21*4882a593Smuzhiyun 		regs->r9 = 0;
22*4882a593Smuzhiyun 	regs->cr_iip = fix & ~0xf;
23*4882a593Smuzhiyun 	ia64_psr(regs)->ri = fix & 0x3;		/* set continuation slot number */
24*4882a593Smuzhiyun }
25