aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel/kprobes.c
diff options
context:
space:
mode:
authorAnil S Keshavamurthy <anil.s.keshavamurthy@intel.com>2005-06-23 03:09:28 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:22 -0400
commitb2761dc262b428475890fffd979687051beb12ba (patch)
tree088fcb3fb1a5e3fc73614dcbfcde9aa2ff7bc1ce /arch/ia64/kernel/kprobes.c
parentfd7b231ff98578308d8f5fb76a25a369ce1074ae (diff)
[PATCH] Kprobes/IA64: architecture specific JProbes support
This patch adds IA64 architecture specific JProbes support on top of Kprobes Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Rusty Lynch <Rusty.lynch@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ia64/kernel/kprobes.c')
-rw-r--r--arch/ia64/kernel/kprobes.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 81a53f99a573..6683a44f419f 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -35,12 +35,15 @@
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/kdebug.h> 36#include <asm/kdebug.h>
37 37
38extern void jprobe_inst_return(void);
39
38/* kprobe_status settings */ 40/* kprobe_status settings */
39#define KPROBE_HIT_ACTIVE 0x00000001 41#define KPROBE_HIT_ACTIVE 0x00000001
40#define KPROBE_HIT_SS 0x00000002 42#define KPROBE_HIT_SS 0x00000002
41 43
42static struct kprobe *current_kprobe; 44static struct kprobe *current_kprobe;
43static unsigned long kprobe_status; 45static unsigned long kprobe_status;
46static struct pt_regs jprobe_saved_regs;
44 47
45enum instruction_type {A, I, M, F, B, L, X, u}; 48enum instruction_type {A, I, M, F, B, L, X, u};
46static enum instruction_type bundle_encoding[32][3] = { 49static enum instruction_type bundle_encoding[32][3] = {
@@ -318,15 +321,28 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val,
318 321
319int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 322int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
320{ 323{
321 printk(KERN_WARNING "Jprobes is not supported\n"); 324 struct jprobe *jp = container_of(p, struct jprobe, kp);
322 return 0; 325 unsigned long addr = ((struct fnptr *)(jp->entry))->ip;
323}
324 326
325void jprobe_return(void) 327 /* save architectural state */
326{ 328 jprobe_saved_regs = *regs;
329
330 /* after rfi, execute the jprobe instrumented function */
331 regs->cr_iip = addr & ~0xFULL;
332 ia64_psr(regs)->ri = addr & 0xf;
333 regs->r1 = ((struct fnptr *)(jp->entry))->gp;
334
335 /*
336 * fix the return address to our jprobe_inst_return() function
337 * in the jprobes.S file
338 */
339 regs->b0 = ((struct fnptr *)(jprobe_inst_return))->ip;
340
341 return 1;
327} 342}
328 343
329int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 344int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
330{ 345{
331 return 0; 346 *regs = jprobe_saved_regs;
347 return 1;
332} 348}