1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
4  */
5 #include <linux/extable.h>
6 #include <linux/spinlock.h>
7 #include <asm/branch.h>
8 #include <linux/uaccess.h>
9 
fixup_exception(struct pt_regs * regs)10 int fixup_exception(struct pt_regs *regs)
11 {
12 	const struct exception_table_entry *fixup;
13 
14 	fixup = search_exception_tables(exception_era(regs));
15 	if (fixup) {
16 		regs->csr_era = fixup->fixup;
17 
18 		return 1;
19 	}
20 
21 	return 0;
22 }
23