Skip to contentSkip to conversation

target-mips: save cpu state before calling MSA load and store helpers

PATCH In review Leon Alrae 2 participants 2 messages Mar 16, 2015 – Mar 30, 2015

lore
Share & tools
lore

Leon Alrae

author
#0 lore raw

PATCH 1/1 target-mips: save cpu state before calling MSA load and store helpers

PC needs to be saved if an exception can be generated by an helper. This fixes a problem related to resuming the execution at unexpected address after an exception (caused by MSA load/store instruction) has been serviced.

---
 target-mips/translate.c | 2 ++
 1 file changed, 2 insertions(+)
target-mips/translate.c +2 -0
index 9059bfd..7a8a00e 100644
@@ -18403,12 +18403,14 @@ static void gen_msa(CPUMIPSState *env, DisasContext *ctx)
             case OPC_LD_H:
             case OPC_LD_W:
             case OPC_LD_D:
+                save_cpu_state(ctx, 1);
                 gen_helper_msa_ld_df(cpu_env, tdf, twd, trs, ts10);
                 break;
             case OPC_ST_B:
             case OPC_ST_H:
             case OPC_ST_W:
             case OPC_ST_D:
+                save_cpu_state(ctx, 1);
                 gen_helper_msa_st_df(cpu_env, tdf, twd, trs, ts10);
                 break;
             }
Signature · 1 line
2.1.0
#1 lore raw
Quoted 3 lines · Leon Alrae

PC needs to be saved if an exception can be generated by an helper. This fixes a problem related to resuming the execution at unexpected address after an exception (caused by MSA load/store instruction) has been serviced.

Only if the helper doesn't use cpu_restore_state.

In this case, all of your do_##name memory routines should instead use helper_[lb]e_*_mmu, which allows you to pass along the mmu_idx (instead of switching on _kernel et al), and the GETRA() value in the top-level helper.

r~