aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include
diff options
context:
space:
mode:
authorChris Smith <chris.smith@st.com>2008-09-05 04:15:39 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-09-07 21:35:05 -0400
commitd39f5450146ff39f66cfde9d5184420627d0ac51 (patch)
treef71bf54b0e633b5a0cf4ca9a72809ba26c813bda /arch/sh/include
parentb6c20e4290a1ef92bcef5ec9dd8e5c7d036153aa (diff)
sh: Add kprobes support.
Initial support for kprobes/kretprobes for 32-bit SH platforms. [ General cleanup and some rework for the kretprobe hash lock. -- PFM ] Signed-off-by: Chris Smith <chris.smith@st.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include')
-rw-r--r--arch/sh/include/asm/kprobes.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/sh/include/asm/kprobes.h b/arch/sh/include/asm/kprobes.h
new file mode 100644
index 000000000000..70fc629df904
--- /dev/null
+++ b/arch/sh/include/asm/kprobes.h
@@ -0,0 +1,59 @@
1#ifndef __ASM_SH_KPROBES_H
2#define __ASM_SH_KPROBES_H
3
4#ifdef CONFIG_KPROBES
5
6#include <linux/types.h>
7#include <linux/ptrace.h>
8
9struct pt_regs;
10
11typedef u16 kprobe_opcode_t;
12#define BREAKPOINT_INSTRUCTION 0xc3ff
13
14#define MAX_INSN_SIZE 16
15#define MAX_STACK_SIZE 64
16#define MIN_STACK_SIZE(ADDR) (((MAX_STACK_SIZE) < \
17 (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR))) \
18 ? (MAX_STACK_SIZE) \
19 : (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
20
21#define regs_return_value(regs) ((regs)->regs[0])
22#define flush_insn_slot(p) do { } while (0)
23#define kretprobe_blacklist_size 0
24
25struct kprobe;
26
27void arch_remove_kprobe(struct kprobe *);
28void kretprobe_trampoline(void);
29void jprobe_return_end(void);
30
31/* Architecture specific copy of original instruction*/
32struct arch_specific_insn {
33 /* copy of the original instruction */
34 kprobe_opcode_t insn[MAX_INSN_SIZE];
35};
36
37struct prev_kprobe {
38 struct kprobe *kp;
39 unsigned long status;
40};
41
42/* per-cpu kprobe control block */
43struct kprobe_ctlblk {
44 unsigned long kprobe_status;
45 unsigned long jprobe_saved_r15;
46 struct pt_regs jprobe_saved_regs;
47 kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
48 struct prev_kprobe prev_kprobe;
49};
50
51extern int kprobe_exceptions_notify(struct notifier_block *self,
52 unsigned long val, void *data);
53extern int kprobe_handle_illslot(unsigned long pc);
54#else
55
56#define kprobe_handle_illslot(pc) (-1)
57
58#endif /* CONFIG_KPROBES */
59#endif /* __ASM_SH_KPROBES_H */