From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: cfontana@suse.de
Subject: [PATCH v2 4/6] target/openrisc: Use cpu_unwind_state_data for mfspr
Date: Thu, 27 Oct 2022 21:02:52 +1100 [thread overview]
Message-ID: <20221027100254.215253-5-richard.henderson@linaro.org> (raw)
In-Reply-To: <20221027100254.215253-1-richard.henderson@linaro.org>
Since we do not plan to exit, use cpu_unwind_state_data
and extract exactly the data requested.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/openrisc/sys_helper.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c
index a3508e421d..dde2fa1623 100644
--- a/target/openrisc/sys_helper.c
+++ b/target/openrisc/sys_helper.c
@@ -199,6 +199,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd,
target_ulong spr)
{
#ifndef CONFIG_USER_ONLY
+ uint64_t data[TARGET_INSN_START_WORDS];
MachineState *ms = MACHINE(qdev_get_machine());
OpenRISCCPU *cpu = env_archcpu(env);
CPUState *cs = env_cpu(env);
@@ -232,14 +233,20 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd,
return env->evbar;
case TO_SPR(0, 16): /* NPC (equals PC) */
- cpu_restore_state(cs, GETPC(), false);
+ if (cpu_unwind_state_data(cs, GETPC(), data)) {
+ return data[0];
+ }
return env->pc;
case TO_SPR(0, 17): /* SR */
return cpu_get_sr(env);
case TO_SPR(0, 18): /* PPC */
- cpu_restore_state(cs, GETPC(), false);
+ if (cpu_unwind_state_data(cs, GETPC(), data)) {
+ if (data[1] & 2) {
+ return data[0] - 4;
+ }
+ }
return env->ppc;
case TO_SPR(0, 32): /* EPCR */
--
2.34.1
next prev parent reply other threads:[~2022-10-27 10:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 10:02 [PATCH v2 0/6] tcg: Fix x86 TARGET_TB_PCREL (#1269) Richard Henderson
2022-10-27 10:02 ` [PATCH v2 1/6] accel/tcg: Introduce cpu_unwind_state_data Richard Henderson
2022-10-27 10:40 ` Claudio Fontana
2022-10-27 11:30 ` Richard Henderson
2022-10-27 11:39 ` Claudio Fontana
2022-10-27 10:02 ` [PATCH v2 2/6] target/i386: Use cpu_unwind_state_data for tpr access Richard Henderson
2022-10-27 12:22 ` Claudio Fontana
2022-10-27 20:13 ` Richard Henderson
2022-10-28 8:10 ` Claudio Fontana
2022-10-27 10:02 ` [PATCH v2 3/6] target/openrisc: Always exit after mtspr npc Richard Henderson
2022-10-27 10:49 ` Philippe Mathieu-Daudé
2022-10-27 10:02 ` Richard Henderson [this message]
2022-10-28 9:16 ` [PATCH v2 4/6] target/openrisc: Use cpu_unwind_state_data for mfspr Claudio Fontana
2022-10-28 18:46 ` Richard Henderson
2022-10-27 10:02 ` [PATCH v2 5/6] accel/tcg: Remove will_exit argument from cpu_restore_state Richard Henderson
2022-10-27 10:02 ` [PATCH v2 6/6] accel/tcg: Remove reset_icount argument from cpu_restore_state_from_tb Richard Henderson
2022-10-31 0:40 ` [PATCH v2 0/6] tcg: Fix x86 TARGET_TB_PCREL (#1269) Richard Henderson
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=20221027100254.215253-5-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=cfontana@suse.de \
--cc=qemu-devel@nongnu.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).