summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/probes/decode-insn.h
diff options
context:
space:
mode:
authorPratyush Anand <panand@redhat.com>2016-11-02 14:40:41 +0530
committerCatalin Marinas <catalin.marinas@arm.com>2016-11-07 18:15:20 +0000
commitc2249707ee53b5dd696f0fae8543a754684ea04a (patch)
treead26181a1ad57978dcf944fa5f2959961833a9cd /arch/arm64/kernel/probes/decode-insn.h
parent1404d6f13e47c42f155e3c6a611b1bf4dd35dde9 (diff)
downloadop-kernel-dev-c2249707ee53b5dd696f0fae8543a754684ea04a.zip
op-kernel-dev-c2249707ee53b5dd696f0fae8543a754684ea04a.tar.gz
arm64: kprobe: protect/rename few definitions to be reused by uprobe
decode-insn code has to be reused by arm64 uprobe implementation as well. Therefore, this patch protects some portion of kprobe code and renames few other, so that decode-insn functionality can be reused by uprobe even when CONFIG_KPROBES is not defined. kprobe_opcode_t and struct arch_specific_insn are also defined by linux/kprobes.h, when CONFIG_KPROBES is not defined. So, protect these definitions in asm/probes.h. linux/kprobes.h already includes asm/kprobes.h. Therefore, remove inclusion of asm/kprobes.h from decode-insn.c. There are some definitions like kprobe_insn and kprobes_handler_t etc can be re-used by uprobe. So, it would be better to remove 'k' from their names. struct arch_specific_insn is specific to kprobe. Therefore, introduce a new struct arch_probe_insn which will be common for both kprobe and uprobe, so that decode-insn code can be shared. Modify kprobe code accordingly. Function arm_probe_decode_insn() will be needed by uprobe as well. So make it global. Signed-off-by: Pratyush Anand <panand@redhat.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/probes/decode-insn.h')
-rw-r--r--arch/arm64/kernel/probes/decode-insn.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm64/kernel/probes/decode-insn.h b/arch/arm64/kernel/probes/decode-insn.h
index d438289..76d3f31 100644
--- a/arch/arm64/kernel/probes/decode-insn.h
+++ b/arch/arm64/kernel/probes/decode-insn.h
@@ -23,13 +23,17 @@
*/
#define MAX_ATOMIC_CONTEXT_SIZE (128 / sizeof(kprobe_opcode_t))
-enum kprobe_insn {
+enum probe_insn {
INSN_REJECTED,
INSN_GOOD_NO_SLOT,
INSN_GOOD,
};
-enum kprobe_insn __kprobes
+#ifdef CONFIG_KPROBES
+enum probe_insn __kprobes
arm_kprobe_decode_insn(kprobe_opcode_t *addr, struct arch_specific_insn *asi);
+#endif
+enum probe_insn __kprobes
+arm_probe_decode_insn(probe_opcode_t insn, struct arch_probe_insn *asi);
#endif /* _ARM_KERNEL_KPROBES_ARM64_H */
OpenPOWER on IntegriCloud