1 // SPDX-License-Identifier: GPL-2.0
3 * Generic return hook for LoongArch.
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, 0);
15 NOKPROBE_SYMBOL(arch_rethook_trampoline_callback);
17 void arch_rethook_prepare(struct rethook_node *rhn, struct pt_regs *regs, bool mcount)
20 rhn->ret_addr = regs->regs[1];
22 /* replace return addr with trampoline */
23 regs->regs[1] = (unsigned long)arch_rethook_trampoline;
25 NOKPROBE_SYMBOL(arch_rethook_prepare);
27 /* ASM function that handles the rethook must not be probed itself */
28 NOKPROBE_SYMBOL(arch_rethook_trampoline);