Commit 1c89cf7f authored by Jordan Niethe's avatar Jordan Niethe Committed by Michael Ellerman

powerpc/sstep: Set NIP in instruction emulation tests

The tests for emulation of compute instructions execute and
emulate an instruction and then compare the results to verify the
emulation. In ISA v3.1 there are instructions that operate relative to
the NIP. Therefore set the NIP in the regs used for the emulated
instruction to the location of the executed instruction so they will
give the same result.

This is a rework of a patch by Balamuruhan S.
Signed-off-by: default avatarJordan Niethe <jniethe5@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200525025923.19843-3-jniethe5@gmail.com
parent 0396de6d
...@@ -1011,11 +1011,14 @@ static struct compute_test compute_tests[] = { ...@@ -1011,11 +1011,14 @@ static struct compute_test compute_tests[] = {
static int __init emulate_compute_instr(struct pt_regs *regs, static int __init emulate_compute_instr(struct pt_regs *regs,
struct ppc_inst instr) struct ppc_inst instr)
{ {
extern s32 patch__exec_instr;
struct instruction_op op; struct instruction_op op;
if (!regs || !ppc_inst_val(instr)) if (!regs || !ppc_inst_val(instr))
return -EINVAL; return -EINVAL;
regs->nip = patch_site_addr(&patch__exec_instr);
if (analyse_instr(&op, regs, instr) != 1 || if (analyse_instr(&op, regs, instr) != 1 ||
GETTYPE(op.type) != COMPUTE) { GETTYPE(op.type) != COMPUTE) {
pr_info("emulation failed, instruction = 0x%08x\n", ppc_inst_val(instr)); pr_info("emulation failed, instruction = 0x%08x\n", ppc_inst_val(instr));
......
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