path: root/arch/csky/include/asm/probes.h
diff options
authorGuo Ren <>2020-04-01 09:17:02 +0800
committerGuo Ren <>2020-04-03 11:14:17 +0800
commit33e53ae1ce413a081254e686d9b27cc1b3585e2f (patch)
treedd6ddbf5a1707f1d0351143cedc00147a465abf4 /arch/csky/include/asm/probes.h
parent000591f1ca3312d9a29e15a9e3fe5c4171f75586 (diff)
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 <> Cc: Arnd Bergmann <> Cc: Steven Rostedt (VMware) <>
Diffstat (limited to 'arch/csky/include/asm/probes.h')
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/csky/include/asm/probes.h b/arch/csky/include/asm/probes.h
new file mode 100644
index 000000000000..5e526334e6f9
--- /dev/null
+++ b/arch/csky/include/asm/probes.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_CSKY_PROBES_H
+#define __ASM_CSKY_PROBES_H
+typedef u32 probe_opcode_t;
+typedef void (probes_handler_t) (u32 opcode, long addr, struct pt_regs *);
+/* architecture specific copy of original instruction */
+struct arch_probe_insn {
+ probe_opcode_t *insn;
+ probes_handler_t *handler;
+ /* restore address after simulation */
+ unsigned long restore;
+typedef u32 kprobe_opcode_t;
+struct arch_specific_insn {
+ struct arch_probe_insn api;
+#endif /* __ASM_CSKY_PROBES_H */