xref: /OK3568_Linux_fs/kernel/arch/arm/mm/extable.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *  linux/arch/arm/mm/extable.c
4*4882a593Smuzhiyun  */
5*4882a593Smuzhiyun #include <linux/extable.h>
6*4882a593Smuzhiyun #include <linux/uaccess.h>
7*4882a593Smuzhiyun 
fixup_exception(struct pt_regs * regs)8*4882a593Smuzhiyun int fixup_exception(struct pt_regs *regs)
9*4882a593Smuzhiyun {
10*4882a593Smuzhiyun 	const struct exception_table_entry *fixup;
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun 	fixup = search_exception_tables(instruction_pointer(regs));
13*4882a593Smuzhiyun 	if (fixup) {
14*4882a593Smuzhiyun 		regs->ARM_pc = fixup->fixup;
15*4882a593Smuzhiyun #ifdef CONFIG_THUMB2_KERNEL
16*4882a593Smuzhiyun 		/* Clear the IT state to avoid nasty surprises in the fixup */
17*4882a593Smuzhiyun 		regs->ARM_cpsr &= ~PSR_IT_MASK;
18*4882a593Smuzhiyun #endif
19*4882a593Smuzhiyun 	}
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun 	return fixup != NULL;
22*4882a593Smuzhiyun }
23