1 // SPDX-License-Identifier: GPL-2.0-only
3 * Generic return hook for riscv.
6 #include <linux/kprobes.h>
7 #include <linux/rethook.h>
10 /* This is called from arch_rethook_trampoline() */
11 unsigned long __used arch_rethook_trampoline_callback(struct pt_regs *regs)
13 return rethook_trampoline_handler(regs, regs->s0);
16 NOKPROBE_SYMBOL(arch_rethook_trampoline_callback);
18 void arch_rethook_prepare(struct rethook_node *rhn, struct pt_regs *regs, bool mcount)
20 rhn->ret_addr = regs->ra;
21 rhn->frame = regs->s0;
23 /* replace return addr with trampoline */
24 regs->ra = (unsigned long)arch_rethook_trampoline;
27 NOKPROBE_SYMBOL(arch_rethook_prepare);