summaryrefslogtreecommitdiffstats
path: root/arch/csky/kernel/probes/decode-insn.h
diff options
context:
space:
mode:
authorGuo Ren <guoren@linux.alibaba.com>2020-04-01 03:17:02 +0200
committerGuo Ren <guoren@linux.alibaba.com>2020-04-03 05:14:17 +0200
commit33e53ae1ce413a081254e686d9b27cc1b3585e2f (patch)
treedd6ddbf5a1707f1d0351143cedc00147a465abf4 /arch/csky/kernel/probes/decode-insn.h
parentcsky: Enable LOCKDEP_SUPPORT (diff)
downloadlinux-33e53ae1ce413a081254e686d9b27cc1b3585e2f.tar.xz
linux-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/decode-insn.h')
-rw-r--r--arch/csky/kernel/probes/decode-insn.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/csky/kernel/probes/decode-insn.h b/arch/csky/kernel/probes/decode-insn.h
new file mode 100644
index 000000000000..9c4ad48fee0d
--- /dev/null
+++ b/arch/csky/kernel/probes/decode-insn.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+#ifndef __CSKY_KERNEL_KPROBES_DECODE_INSN_H
+#define __CSKY_KERNEL_KPROBES_DECODE_INSN_H
+
+#include <asm/sections.h>
+#include <asm/kprobes.h>
+
+enum probe_insn {
+ INSN_REJECTED,
+ INSN_GOOD_NO_SLOT,
+ INSN_GOOD,
+};
+
+#define is_insn32(insn) ((insn & 0xc000) == 0xc000)
+
+enum probe_insn __kprobes
+csky_probe_decode_insn(probe_opcode_t *addr, struct arch_probe_insn *asi);
+
+#endif /* __CSKY_KERNEL_KPROBES_DECODE_INSN_H */