linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jordan Niethe <jniethe5@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: alistair@popple.id.au, Jordan Niethe <jniethe5@gmail.com>,
	bala24@linux.ibm.com
Subject: [PATCH 3/5] powerpc sstep: Set NIP in instruction emulation tests
Date: Mon, 25 May 2020 12:59:21 +1000	[thread overview]
Message-ID: <20200525025923.19843-3-jniethe5@gmail.com> (raw)
In-Reply-To: <20200525025923.19843-1-jniethe5@gmail.com>

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>
---
 arch/powerpc/lib/test_emulate_step.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/lib/test_emulate_step.c b/arch/powerpc/lib/test_emulate_step.c
index 9599f3a03ca1..427c2ca8191e 100644
--- a/arch/powerpc/lib/test_emulate_step.c
+++ b/arch/powerpc/lib/test_emulate_step.c
@@ -1076,11 +1076,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));
-- 
2.17.1


  parent reply	other threads:[~2020-05-25  3:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  2:59 [PATCH 1/5] powerpc sstep: Add tests for prefixed integer load/stores Jordan Niethe
2020-05-25  2:59 ` [PATCH 2/5] powerpc sstep: Add tests for prefixed floating-point load/stores Jordan Niethe
2020-05-25  2:59 ` Jordan Niethe [this message]
2020-05-25  2:59 ` [PATCH 4/5] powerpc sstep: Let compute tests specify a required cpu feature Jordan Niethe
2020-05-25  2:59 ` [PATCH 5/5] powerpc sstep: Add tests for Prefixed Add Immediate Jordan Niethe
2020-07-22  1:26   ` Jordan Niethe
2020-07-22  5:47     ` Michael Ellerman
2020-07-24 13:24 ` [PATCH 1/5] powerpc sstep: Add tests for prefixed integer load/stores Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200525025923.19843-3-jniethe5@gmail.com \
    --to=jniethe5@gmail.com \
    --cc=alistair@popple.id.au \
    --cc=bala24@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).