Merge tag 'coresight-fixes-v5.16' of gitolite.kernel.org:pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / arch / riscv / mm / extable.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
4  *  Lennox Wu <lennox.wu@sunplusct.com>
5  *  Chen Liqin <liqin.chen@sunplusct.com>
6  * Copyright (C) 2013 Regents of the University of California
7  */
8
9
10 #include <linux/extable.h>
11 #include <linux/module.h>
12 #include <linux/uaccess.h>
13
14 #ifdef CONFIG_BPF_JIT
15 int rv_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs);
16 #endif
17
18 int fixup_exception(struct pt_regs *regs)
19 {
20         const struct exception_table_entry *fixup;
21
22         fixup = search_exception_tables(regs->epc);
23         if (!fixup)
24                 return 0;
25
26 #ifdef CONFIG_BPF_JIT
27         if (regs->epc >= BPF_JIT_REGION_START && regs->epc < BPF_JIT_REGION_END)
28                 return rv_bpf_fixup_exception(fixup, regs);
29 #endif
30
31         regs->epc = fixup->fixup;
32         return 1;
33 }