From b2761dc262b428475890fffd979687051beb12ba Mon Sep 17 00:00:00 2001 From: Anil S Keshavamurthy Date: Thu, 23 Jun 2005 00:09:28 -0700 Subject: [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 Signed-off-by: Rusty Lynch Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ia64/kernel/kprobes.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'arch/ia64/kernel/kprobes.c') diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 81a53f99a57..6683a44f419 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c @@ -35,12 +35,15 @@ #include #include +extern void jprobe_inst_return(void); + /* kprobe_status settings */ #define KPROBE_HIT_ACTIVE 0x00000001 #define KPROBE_HIT_SS 0x00000002 static struct kprobe *current_kprobe; static unsigned long kprobe_status; +static struct pt_regs jprobe_saved_regs; enum instruction_type {A, I, M, F, B, L, X, u}; static enum instruction_type bundle_encoding[32][3] = { @@ -318,15 +321,28 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) { - printk(KERN_WARNING "Jprobes is not supported\n"); - return 0; -} + struct jprobe *jp = container_of(p, struct jprobe, kp); + unsigned long addr = ((struct fnptr *)(jp->entry))->ip; -void jprobe_return(void) -{ + /* save architectural state */ + jprobe_saved_regs = *regs; + + /* after rfi, execute the jprobe instrumented function */ + regs->cr_iip = addr & ~0xFULL; + ia64_psr(regs)->ri = addr & 0xf; + regs->r1 = ((struct fnptr *)(jp->entry))->gp; + + /* + * fix the return address to our jprobe_inst_return() function + * in the jprobes.S file + */ + regs->b0 = ((struct fnptr *)(jprobe_inst_return))->ip; + + return 1; } int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) { - return 0; + *regs = jprobe_saved_regs; + return 1; } -- cgit v1.2.3