forked from Minki/linux
[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>
This commit is contained in:
parent
371db06b01
commit
92b8cbf17a
@ -70,10 +70,8 @@ struct kprobe_ctlblk {
|
|||||||
unsigned long kprobe_status;
|
unsigned long kprobe_status;
|
||||||
unsigned long kprobe_saved_imask;
|
unsigned long kprobe_saved_imask;
|
||||||
unsigned long kprobe_saved_ctl[3];
|
unsigned long kprobe_saved_ctl[3];
|
||||||
struct pt_regs jprobe_saved_regs;
|
|
||||||
unsigned long jprobe_saved_r14;
|
|
||||||
unsigned long jprobe_saved_r15;
|
|
||||||
struct prev_kprobe prev_kprobe;
|
struct prev_kprobe prev_kprobe;
|
||||||
|
struct pt_regs jprobe_saved_regs;
|
||||||
kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
|
kprobe_opcode_t jprobes_stack[MAX_STACK_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -585,8 +585,8 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
|
|||||||
int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
|
int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct jprobe *jp = container_of(p, struct jprobe, kp);
|
struct jprobe *jp = container_of(p, struct jprobe, kp);
|
||||||
unsigned long addr;
|
|
||||||
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
||||||
|
unsigned long stack;
|
||||||
|
|
||||||
memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs));
|
memcpy(&kcb->jprobe_saved_regs, regs, sizeof(struct pt_regs));
|
||||||
|
|
||||||
@ -594,14 +594,10 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
|
|||||||
regs->psw.addr = (unsigned long)(jp->entry) | PSW_ADDR_AMODE;
|
regs->psw.addr = (unsigned long)(jp->entry) | PSW_ADDR_AMODE;
|
||||||
regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT);
|
regs->psw.mask &= ~(PSW_MASK_IO | PSW_MASK_EXT);
|
||||||
|
|
||||||
/* r14 is the function return address */
|
|
||||||
kcb->jprobe_saved_r14 = (unsigned long)regs->gprs[14];
|
|
||||||
/* r15 is the stack pointer */
|
/* r15 is the stack pointer */
|
||||||
kcb->jprobe_saved_r15 = (unsigned long)regs->gprs[15];
|
stack = (unsigned long) regs->gprs[15];
|
||||||
addr = (unsigned long)kcb->jprobe_saved_r15;
|
|
||||||
|
|
||||||
memcpy(kcb->jprobes_stack, (kprobe_opcode_t *) addr,
|
memcpy(kcb->jprobes_stack, (void *) stack, MIN_STACK_SIZE(stack));
|
||||||
MIN_STACK_SIZE(addr));
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,13 +614,14 @@ void __kprobes jprobe_return_end(void)
|
|||||||
int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
|
int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
|
||||||
{
|
{
|
||||||
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
|
||||||
unsigned long stack_addr = (unsigned long)(kcb->jprobe_saved_r15);
|
unsigned long stack;
|
||||||
|
|
||||||
|
stack = (unsigned long) kcb->jprobe_saved_regs.gprs[15];
|
||||||
|
|
||||||
/* Put the regs back */
|
/* Put the regs back */
|
||||||
memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs));
|
memcpy(regs, &kcb->jprobe_saved_regs, sizeof(struct pt_regs));
|
||||||
/* put the stack back */
|
/* put the stack back */
|
||||||
memcpy((kprobe_opcode_t *) stack_addr, kcb->jprobes_stack,
|
memcpy((void *) stack, kcb->jprobes_stack, MIN_STACK_SIZE(stack));
|
||||||
MIN_STACK_SIZE(stack_addr));
|
|
||||||
preempt_enable_no_resched();
|
preempt_enable_no_resched();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user