[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 27/29] target/openrisc: Use cpu_unwind_state_data for mfspr
From: |
Richard Henderson |
Subject: |
[PATCH 27/29] target/openrisc: Use cpu_unwind_state_data for mfspr |
Date: |
Mon, 24 Oct 2022 23:24:57 +1000 |
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
- [PATCH 23/29] accel/tcg: Remove restore_state_to_opc function, (continued)
- [PATCH 23/29] accel/tcg: Remove restore_state_to_opc function, Richard Henderson, 2022/10/24
- [PATCH 20/29] target/sparc: Convert to tcg_ops restore_state_to_opc, Richard Henderson, 2022/10/24
- [PATCH 19/29] target/sh4: Convert to tcg_ops restore_state_to_opc, Richard Henderson, 2022/10/24
- [PATCH 26/29] target/openrisc: Always exit after mtspr npc, Richard Henderson, 2022/10/24
- [PATCH 25/29] target/i386: Use cpu_unwind_state_data for tpr access, Richard Henderson, 2022/10/24
- [PATCH 27/29] target/openrisc: Use cpu_unwind_state_data for mfspr,
Richard Henderson <=
- [PATCH 28/29] accel/tcg: Remove will_exit argument from cpu_restore_state, Richard Henderson, 2022/10/24
- [PATCH 24/29] accel/tcg: Introduce cpu_unwind_state_data, Richard Henderson, 2022/10/24
- [PATCH 29/29] accel/tcg: Remove reset_icount argument from cpu_restore_state_from_tb, Richard Henderson, 2022/10/24