diff options
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/kernel/kprobes.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c index 7066d7ba667a..d67195ba3fa2 100644 --- a/arch/sparc64/kernel/kprobes.c +++ b/arch/sparc64/kernel/kprobes.c | |||
@@ -6,7 +6,6 @@ | |||
6 | #include <linux/config.h> | 6 | #include <linux/config.h> |
7 | #include <linux/kernel.h> | 7 | #include <linux/kernel.h> |
8 | #include <linux/kprobes.h> | 8 | #include <linux/kprobes.h> |
9 | |||
10 | #include <asm/kdebug.h> | 9 | #include <asm/kdebug.h> |
11 | #include <asm/signal.h> | 10 | #include <asm/signal.h> |
12 | 11 | ||
@@ -47,6 +46,19 @@ void arch_copy_kprobe(struct kprobe *p) | |||
47 | { | 46 | { |
48 | p->ainsn.insn[0] = *p->addr; | 47 | p->ainsn.insn[0] = *p->addr; |
49 | p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; | 48 | p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; |
49 | p->opcode = *p->addr; | ||
50 | } | ||
51 | |||
52 | void arch_arm_kprobe(struct kprobe *p) | ||
53 | { | ||
54 | *p->addr = BREAKPOINT_INSTRUCTION; | ||
55 | flushi(p->addr); | ||
56 | } | ||
57 | |||
58 | void arch_disarm_kprobe(struct kprobe *p) | ||
59 | { | ||
60 | *p->addr = p->opcode; | ||
61 | flushi(p->addr); | ||
50 | } | 62 | } |
51 | 63 | ||
52 | void arch_remove_kprobe(struct kprobe *p) | 64 | void arch_remove_kprobe(struct kprobe *p) |
@@ -78,17 +90,6 @@ static inline void prepare_singlestep(struct kprobe *p, struct pt_regs *regs) | |||
78 | } | 90 | } |
79 | } | 91 | } |
80 | 92 | ||
81 | static inline void disarm_kprobe(struct kprobe *p, struct pt_regs *regs) | ||
82 | { | ||
83 | *p->addr = p->opcode; | ||
84 | flushi(p->addr); | ||
85 | |||
86 | regs->tpc = (unsigned long) p->addr; | ||
87 | regs->tnpc = current_kprobe_orig_tnpc; | ||
88 | regs->tstate = ((regs->tstate & ~TSTATE_PIL) | | ||
89 | current_kprobe_orig_tstate_pil); | ||
90 | } | ||
91 | |||
92 | static int kprobe_handler(struct pt_regs *regs) | 93 | static int kprobe_handler(struct pt_regs *regs) |
93 | { | 94 | { |
94 | struct kprobe *p; | 95 | struct kprobe *p; |
@@ -109,7 +110,11 @@ static int kprobe_handler(struct pt_regs *regs) | |||
109 | unlock_kprobes(); | 110 | unlock_kprobes(); |
110 | goto no_kprobe; | 111 | goto no_kprobe; |
111 | } | 112 | } |
112 | disarm_kprobe(p, regs); | 113 | arch_disarm_kprobe(p); |
114 | regs->tpc = (unsigned long) p->addr; | ||
115 | regs->tnpc = current_kprobe_orig_tnpc; | ||
116 | regs->tstate = ((regs->tstate & ~TSTATE_PIL) | | ||
117 | current_kprobe_orig_tstate_pil); | ||
113 | ret = 1; | 118 | ret = 1; |
114 | } else { | 119 | } else { |
115 | p = current_kprobe; | 120 | p = current_kprobe; |