On 7/31/25 9:29 PM, Richard Henderson wrote:
On 8/1/25 05:13, Pierrick Bouvier wrote:
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
index 71c6c44ee8..f61adf1f80 100644
--- a/target/arm/tcg/helper-a64.c
+++ b/target/arm/tcg/helper-a64.c
@@ -639,7 +639,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t 
new_pc)
       ARMCPU *cpu = env_archcpu(env);
       int cur_el = arm_current_el(env);
       unsigned int spsr_idx = aarch64_banked_spsr_index(cur_el);
-    uint32_t spsr = env->banked_spsr[spsr_idx];
+    uint64_t spsr = env->banked_spsr[spsr_idx];
       int new_el;
       bool return_to_aa64 = (spsr & PSTATE_nRW) == 0;

Would that be better or worse to simply save the upper 32 bits, considering 
that cpsr
already holds the lower ones in Aarch64 mode?

I don't understand this comment.

(1) banked_spsr[] is already uint64_t
(2) SPSR_ELx is supposed to be uint64_t
(3) We were accidentally dropping the high bits of spsr here
      because the local variable had the wrong type, before it
      gets sent to pstate_write().


My comment was related to vmstate_pstate64. Sorry it was confusing as I left the last change concerning helper-a64.c, which was not related at all.

So the comment was that vmstate_cpsr already contains the lower 32 bits of pstate, and thus we could save only the upper part in the new field.


r~


Reply via email to