Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Based on arch/arm/mm/extable.c |
| 4 | */ |
| 5 | |
| 6 | #include <linux/extable.h> |
| 7 | #include <linux/uaccess.h> |
| 8 | |
| 9 | int fixup_exception(struct pt_regs *regs) |
| 10 | { |
| 11 | const struct exception_table_entry *fixup; |
| 12 | |
| 13 | fixup = search_exception_tables(instruction_pointer(regs)); |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 14 | if (!fixup) |
| 15 | return 0; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 16 | |
Olivier Deprez | 157378f | 2022-04-04 15:47:50 +0200 | [diff] [blame^] | 17 | if (in_bpf_jit(regs)) |
| 18 | return arm64_bpf_fixup_exception(fixup, regs); |
| 19 | |
| 20 | regs->pc = (unsigned long)&fixup->fixup + fixup->fixup; |
| 21 | return 1; |
Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 22 | } |