summaryrefslogtreecommitdiff
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorJordan Niethe <jniethe5@gmail.com>2020-05-25 12:59:21 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2020-07-23 17:25:15 +1000
commit1c89cf7fbed36f078b20fd47d308b4fc6dbff5f6 (patch)
tree7c2610c785978f372d9a6e32ce20bfa69b2d7be1 /arch/powerpc/lib
parent0396de6d8561c721b03fce386eb9682b37a26013 (diff)
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: Jordan Niethe <jniethe5@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200525025923.19843-3-jniethe5@gmail.com
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/test_emulate_step.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c
index 0059290f0fed..857b95ef5713 100644
--- a/arch/powerpc/lib/test_emulate_step.c
+++ b/arch/powerpc/lib/test_emulate_step.c
@@ -1011,11 +1011,14 @@ static struct compute_test compute_tests[] = {
static int __init emulate_compute_instr(struct pt_regs *regs,
struct ppc_inst instr)
{
+ extern s32 patch__exec_instr;
struct instruction_op op;
if (!regs || !ppc_inst_val(instr))
return -EINVAL;
+ regs->nip = patch_site_addr(&patch__exec_instr);
+
if (analyse_instr(&op, regs, instr) != 1 ||
GETTYPE(op.type) != COMPUTE) {
pr_info("emulation failed, instruction = 0x%08x\n", ppc_inst_val(instr));