diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-01-05 06:47:22 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2011-01-05 06:47:24 -0500 |
commit | 92b8cbf17ae98a118d3e4a123246a05130114d06 (patch) | |
tree | fe37d55e1f22be880968372c8188204147a4b706 /arch/s390 | |
parent | 371db06b017c518da2d69ae278c5978ebcd1041a (diff) |
[S390] kprobes: jprobe save and restore
Register %r14 and %r15 are already stored in jprobe_saved_regs, no need
to store them a second time in jprobe_saved_r14 / jprobe_saved_r15.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/kprobes.h | 4 | ||||
-rw-r--r-- | arch/s390/kernel/kprobes.c | 17 |
2 files changed, 8 insertions, 13 deletions
diff --git a/arch/s390/include/asm/kprobes.h b/arch/s390/include/asm/kprobes.h index 02a822e8ef75..a231a9439c4b 100644 --- a/arch/s390/include/asm/kprobes.h +++ b/arch/s390/include/asm/kprobes.h | |||
@@ -70,10 +70,8 @@ struct kprobe_ctlblk { | |||
70 | unsigned long kprobe_status; | 70 | unsigned long kprobe_status; |
71 | unsigned long kprobe_saved_imask; | 71 | unsigned long kprobe_saved_imask; |
72 | unsigned long kprobe_saved_ctl[3]; | 72 | unsigned long kprobe_saved_ctl[3]; |
73 | struct pt_regs jprobe_saved_regs; | ||
74 | unsigned long jprobe_saved_r14; | ||
75 | unsigned long jprobe_saved_r15; | ||
76 | struct prev_kprobe prev_kprobe; | 73 | struct prev_kprobe prev_kprobe; |
74 | struct pt_regs jprobe_saved_regs; | ||
77 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; | 75 | kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE]; |
78 | }; | 76 | }; |
79 | 77 | ||
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index 61f0b6c3618c..4efd5dbfd72d 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c | |||
@@ -585,8 +585,8 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, | |||
585 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 585 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
586 | { | 586 | { |
587 | struct jprobe *jp = container_of(p, struct jprobe, kp); | 587 | struct jprobe *jp = container_of(p, struct jprobe, kp); |
588 | unsigned long addr; | ||
589 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 588 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
589 | unsigned long stack; | ||
590 | 590 | ||
591 | memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); | 591 | memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs)); |
592 | 592 | ||
@@ -594,14 +594,10 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
594 | regs->psw.addr = (unsigned long)(jp->entry) | PSW_ADDR_AMODE; | 594 | regs->psw.addr = (unsigned long)(jp->entry) | PSW_ADDR_AMODE; |
595 | regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT); | 595 | regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT); |
596 | 596 | ||
597 | /* r14 is the function return address */ | ||
598 | kcb->jprobe_saved_r14 = (unsigned long)regs->gprs[14]; | ||
599 | /* r15 is the stack pointer */ | 597 | /* r15 is the stack pointer */ |
600 | kcb->jprobe_saved_r15 = (unsigned long)regs->gprs[15]; | 598 | stack = (unsigned long) regs->gprs[15]; |
601 | addr = (unsigned long)kcb->jprobe_saved_r15; | ||
602 | 599 | ||
603 | memcpy(kcb->jprobes_stack, (kprobe_opcode_t *) addr, | 600 | memcpy(kcb->jprobes_stack, (void *) stack, MIN_STACK_SIZE(stack)); |
604 | MIN_STACK_SIZE(addr)); | ||
605 | return 1; | 601 | return 1; |
606 | } | 602 | } |
607 | 603 | ||
@@ -618,13 +614,14 @@ void __kprobes jprobe_return_end(void) | |||
618 | int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | 614 | int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) |
619 | { | 615 | { |
620 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | 616 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); |
621 | unsigned long stack_addr = (unsigned long)(kcb->jprobe_saved_r15); | 617 | unsigned long stack; |
618 | |||
619 | stack = (unsigned long) kcb->jprobe_saved_regs.gprs[15]; | ||
622 | 620 | ||
623 | /* Put the regs back */ | 621 | /* Put the regs back */ |
624 | memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs)); | 622 | memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs)); |
625 | /* put the stack back */ | 623 | /* put the stack back */ |
626 | memcpy((kprobe_opcode_t *) stack_addr, kcb->jprobes_stack, | 624 | memcpy((void *) stack, kcb->jprobes_stack, MIN_STACK_SIZE(stack)); |
627 | MIN_STACK_SIZE(stack_addr)); | ||
628 | preempt_enable_no_resched(); | 625 | preempt_enable_no_resched(); |
629 | return 1; | 626 | return 1; |
630 | } | 627 | } |