diff options
author | Guo Ren <guoren@linux.alibaba.com> | 2020-04-01 09:17:02 +0800 |
---|---|---|
committer | Guo Ren <guoren@linux.alibaba.com> | 2020-04-03 11:14:17 +0800 |
commit | 33e53ae1ce413a081254e686d9b27cc1b3585e2f (patch) | |
tree | dd6ddbf5a1707f1d0351143cedc00147a465abf4 /arch/csky/kernel/probes/kprobes_trampoline.S | |
parent | 000591f1ca3312d9a29e15a9e3fe5c4171f75586 (diff) | |
download | linux-stable-33e53ae1ce413a081254e686d9b27cc1b3585e2f.tar.gz linux-stable-33e53ae1ce413a081254e686d9b27cc1b3585e2f.tar.bz2 linux-stable-33e53ae1ce413a081254e686d9b27cc1b3585e2f.zip |
csky: Add kprobes supported
This patch enable kprobes, kretprobes, ftrace interface. It utilized
software breakpoint and single step debug exceptions, instructions
simulation on csky.
We use USR_BKPT replace origin instruction, and the kprobe handler
prepares an excutable memory slot for out-of-line execution with a
copy of the original instruction being probed. Most of instructions
could be executed by single-step, but some instructions need origin
pc value to execute and we need software simulate these instructions.
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'arch/csky/kernel/probes/kprobes_trampoline.S')
-rw-r--r-- | arch/csky/kernel/probes/kprobes_trampoline.S | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/csky/kernel/probes/kprobes_trampoline.S b/arch/csky/kernel/probes/kprobes_trampoline.S new file mode 100644 index 000000000000..b1fe3af24f03 --- /dev/null +++ b/arch/csky/kernel/probes/kprobes_trampoline.S @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#include <linux/linkage.h> + +#include <abi/entry.h> + +ENTRY(kretprobe_trampoline) + SAVE_REGS_FTRACE + + mov a0, sp /* pt_regs */ + + jbsr trampoline_probe_handler + + /* use the result as the return-address */ + mov lr, a0 + + RESTORE_REGS_FTRACE + rts +ENDPROC(kretprobe_trampoline) |