diff options
Diffstat (limited to 'arch/ia64/kernel/kprobes.c')
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 28 |
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 | ||
38 | extern 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 | ||
42 | static struct kprobe *current_kprobe; | 44 | static struct kprobe *current_kprobe; |
43 | static unsigned long kprobe_status; | 45 | static unsigned long kprobe_status; |
46 | static struct pt_regs jprobe_saved_regs; | ||
44 | 47 | ||
45 | enum instruction_type {A, I, M, F, B, L, X, u}; | 48 | enum instruction_type {A, I, M, F, B, L, X, u}; |
46 | static enum instruction_type bundle_encoding[32][3] = { | 49 | static enum instruction_type bundle_encoding[32][3] = { |
@@ -318,15 +321,28 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, | |||
318 | 321 | ||
319 | int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 322 | int 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 | ||
325 | void 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 | ||
329 | int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | 344 | int 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 | } |