s390/kprobes: use insn_length helper function

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Heiko Carstens 2013-09-13 13:59:26 +02:00 committed by Martin Schwidefsky
parent 0f20822a69
commit a882b3b067

View File

@ -26,11 +26,12 @@
#include <linux/stop_machine.h> #include <linux/stop_machine.h>
#include <linux/kdebug.h> #include <linux/kdebug.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <asm/cacheflush.h>
#include <asm/sections.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <asm/cacheflush.h>
#include <asm/sections.h>
#include <asm/dis.h>
DEFINE_PER_CPU(struct kprobe *, current_kprobe); DEFINE_PER_CPU(struct kprobe *, current_kprobe);
DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
@ -208,7 +209,7 @@ static void __kprobes copy_instruction(struct kprobe *p)
s64 disp, new_disp; s64 disp, new_disp;
u64 addr, new_addr; u64 addr, new_addr;
memcpy(p->ainsn.insn, p->addr, ((p->opcode >> 14) + 3) & -2); memcpy(p->ainsn.insn, p->addr, insn_length(p->opcode >> 8));
if (!is_insn_relative_long(p->ainsn.insn)) if (!is_insn_relative_long(p->ainsn.insn))
return; return;
/* /*
@ -608,7 +609,7 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
ip += (unsigned long) p->addr - (unsigned long) p->ainsn.insn; ip += (unsigned long) p->addr - (unsigned long) p->ainsn.insn;
if (fixup & FIXUP_BRANCH_NOT_TAKEN) { if (fixup & FIXUP_BRANCH_NOT_TAKEN) {
int ilen = ((p->ainsn.insn[0] >> 14) + 3) & -2; int ilen = insn_length(p->ainsn.insn[0] >> 8);
if (ip - (unsigned long) p->ainsn.insn == ilen) if (ip - (unsigned long) p->ainsn.insn == ilen)
ip = (unsigned long) p->addr + ilen; ip = (unsigned long) p->addr + ilen;
} }