summaryrefslogtreecommitdiff
path: root/include/asm-arm/kprobes.h
diff options
context:
space:
mode:
authorAbhishek Sagar <sagar.abhishek@gmail.com>2007-06-11 22:20:10 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-26 15:25:16 +0000
commit24ba613c9d6cad315f484e658288db152f1dc447 (patch)
tree0a94ff96c77ccf7e0415bd2bc76ab400468c5e6e /include/asm-arm/kprobes.h
parent35aa1df4328340f38edc46f00837f08d33d49f63 (diff)
downloadlwn-24ba613c9d6cad315f484e658288db152f1dc447.tar.gz
lwn-24ba613c9d6cad315f484e658288db152f1dc447.zip
ARM kprobes: core code
This is a full implementation of Kprobes including Jprobes and Kretprobes support. This ARM implementation does not follow the usual kprobes double- exception model. The traditional model is where the initial kprobes breakpoint calls kprobe_handler(), which returns from exception to execute the instruction in its original context, then immediately re-enters after a second breakpoint (or single-stepping exception) into post_kprobe_handler(), each time the probe is hit.. The ARM implementation only executes one kprobes exception per hit, so no post_kprobe_handler() phase. All side-effects from the kprobe'd instruction are resolved before returning from the initial exception. As a result, all instructions are _always_ effectively boosted regardless of the type of instruction, and even regardless of whether or not there is a post-handler for the probe. Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com> Signed-off-by: Quentin Barnes <qbarnes@gmail.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'include/asm-arm/kprobes.h')
-rw-r--r--include/asm-arm/kprobes.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/asm-arm/kprobes.h b/include/asm-arm/kprobes.h
index 951322328793..273f37413ee6 100644
--- a/include/asm-arm/kprobes.h
+++ b/include/asm-arm/kprobes.h
@@ -18,6 +18,16 @@
#include <linux/types.h>
#include <linux/ptrace.h>
+#include <linux/percpu.h>
+
+#define ARCH_SUPPORTS_KRETPROBES
+#define __ARCH_WANT_KPROBES_INSN_SLOT
+#define MAX_INSN_SIZE 2
+#define MAX_STACK_SIZE 64 /* 32 would probably be OK */
+
+#define regs_return_value(regs) ((regs)->ARM_r0)
+#define flush_insn_slot(p) do { } while (0)
+#define kretprobe_blacklist_size 0
typedef u32 kprobe_opcode_t;
@@ -30,6 +40,25 @@ struct arch_specific_insn {
kprobe_insn_handler_t *insn_handler;
};
+struct prev_kprobe {
+ struct kprobe *kp;
+ unsigned int status;
+};
+
+/* per-cpu kprobe control block */
+struct kprobe_ctlblk {
+ unsigned int kprobe_status;
+ struct prev_kprobe prev_kprobe;
+ struct pt_regs jprobe_saved_regs;
+ char jprobes_stack[MAX_STACK_SIZE];
+};
+
+void arch_remove_kprobe(struct kprobe *);
+
+int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
+int kprobe_exceptions_notify(struct notifier_block *self,
+ unsigned long val, void *data);
+
enum kprobe_insn {
INSN_REJECTED,
INSN_GOOD,