diff options
author | Christoph Hellwig <hch@lst.de> | 2007-05-08 03:34:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:19 -0400 |
commit | 4c4308cb93450989846ac49faeb6dab943e7657e (patch) | |
tree | c06092cae6f95a243cdd758d07491cf5fa24a1dd /arch/ia64/kernel | |
parent | 6f716acd5fa20ae6a35ab29ae37fa9189e839ed5 (diff) |
kprobes: kretprobes simplifications
- consolidate duplicate code in all arch_prepare_kretprobe instances
into common code
- replace various odd helpers that use hlist_for_each_entry to get
the first elemenet of a list with either a hlist_for_each_entry_save
or an opencoded access to the first element in the caller
- inline add_rp_inst into it's only remaining caller
- use kretprobe_inst_table_head instead of opencoding it
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/ia64/kernel')
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 353689edebd..0b72f0f9419 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -465,23 +465,13 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
465 | } | 465 | } |
466 | 466 | ||
467 | /* Called with kretprobe_lock held */ | 467 | /* Called with kretprobe_lock held */ |
468 | void __kprobes arch_prepare_kretprobe(struct kretprobe *rp, | 468 | void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri, |
469 | struct pt_regs *regs) | 469 | struct pt_regs *regs) |
470 | { | 470 | { |
471 | struct kretprobe_instance *ri; | 471 | ri->ret_addr = (kprobe_opcode_t *)regs->b0; |
472 | 472 | ||
473 | if ((ri = get_free_rp_inst(rp)) != NULL) { | 473 | /* Replace the return addr with trampoline addr */ |
474 | ri->rp = rp; | 474 | regs->b0 = ((struct fnptr *)kretprobe_trampoline)->ip; |
475 | ri->task = current; | ||
476 | ri->ret_addr = (kprobe_opcode_t *)regs->b0; | ||
477 | |||
478 | /* Replace the return addr with trampoline addr */ | ||
479 | regs->b0 = ((struct fnptr *)kretprobe_trampoline)->ip; | ||
480 | |||
481 | add_rp_inst(ri); | ||
482 | } else { | ||
483 | rp->nmissed++; | ||
484 | } | ||
485 | } | 475 | } |
486 | 476 | ||
487 | int __kprobes arch_prepare_kprobe(struct kprobe *p) | 477 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |