diff options
author | Abhishek Sagar <sagar.abhishek@gmail.com> | 2007-06-11 18:20:10 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:25:16 -0500 |
commit | 24ba613c9d6cad315f484e658288db152f1dc447 (patch) | |
tree | 0a94ff96c77ccf7e0415bd2bc76ab400468c5e6e /include/asm-arm/kprobes.h | |
parent | 35aa1df4328340f38edc46f00837f08d33d49f63 (diff) |
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.h | 29 |
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 @@ | |||
18 | 18 | ||
19 | #include <linux/types.h> | 19 | #include <linux/types.h> |
20 | #include <linux/ptrace.h> | 20 | #include <linux/ptrace.h> |
21 | #include <linux/percpu.h> | ||
22 | |||
23 | #define ARCH_SUPPORTS_KRETPROBES | ||
24 | #define __ARCH_WANT_KPROBES_INSN_SLOT | ||
25 | #define MAX_INSN_SIZE 2 | ||
26 | #define MAX_STACK_SIZE 64 /* 32 would probably be OK */ | ||
27 | |||
28 | #define regs_return_value(regs) ((regs)->ARM_r0) | ||
29 | #define flush_insn_slot(p) do { } while (0) | ||
30 | #define kretprobe_blacklist_size 0 | ||
21 | 31 | ||
22 | typedef u32 kprobe_opcode_t; | 32 | typedef u32 kprobe_opcode_t; |
23 | 33 | ||
@@ -30,6 +40,25 @@ struct arch_specific_insn { | |||
30 | kprobe_insn_handler_t *insn_handler; | 40 | kprobe_insn_handler_t *insn_handler; |
31 | }; | 41 | }; |
32 | 42 | ||
43 | struct prev_kprobe { | ||
44 | struct kprobe *kp; | ||
45 | unsigned int status; | ||
46 | }; | ||
47 | |||
48 | /* per-cpu kprobe control block */ | ||
49 | struct kprobe_ctlblk { | ||
50 | unsigned int kprobe_status; | ||
51 | struct prev_kprobe prev_kprobe; | ||
52 | struct pt_regs jprobe_saved_regs; | ||
53 | char jprobes_stack[MAX_STACK_SIZE]; | ||
54 | }; | ||
55 | |||
56 | void arch_remove_kprobe(struct kprobe *); | ||
57 | |||
58 | int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr); | ||
59 | int kprobe_exceptions_notify(struct notifier_block *self, | ||
60 | unsigned long val, void *data); | ||
61 | |||
33 | enum kprobe_insn { | 62 | enum kprobe_insn { |
34 | INSN_REJECTED, | 63 | INSN_REJECTED, |
35 | INSN_GOOD, | 64 | INSN_GOOD, |