Commit a8646f43 authored by Jordan Niethe's avatar Jordan Niethe Committed by Michael Ellerman

powerpc/kprobes: Use patch_instruction()

Instead of using memcpy() and flush_icache_range() use
patch_instruction() which not only accomplishes both of these steps but
will also make it easier to add support for prefixed instructions.
Signed-off-by: default avatarJordan Niethe <jniethe5@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Reviewed-by: default avatarAlistair Popple <alistair@popple.id.au>
Link: https://lore.kernel.org/r/20200506034050.24806-16-jniethe5@gmail.com
parent 95b980a0
...@@ -125,11 +125,8 @@ int arch_prepare_kprobe(struct kprobe *p) ...@@ -125,11 +125,8 @@ int arch_prepare_kprobe(struct kprobe *p)
} }
if (!ret) { if (!ret) {
memcpy(p->ainsn.insn, p->addr, patch_instruction((struct ppc_inst *)p->ainsn.insn, insn);
MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
p->opcode = ppc_inst_val(insn); p->opcode = ppc_inst_val(insn);
flush_icache_range((unsigned long)p->ainsn.insn,
(unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t));
} }
p->ainsn.boostable = 0; p->ainsn.boostable = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment