target/sh4: Keep env->flags clean
authorRichard Henderson <rth@twiddle.net>
Tue, 18 Jul 2017 20:02:29 +0000 (10:02 -1000)
committerAurelien Jarno <aurelien@aurel32.net>
Tue, 18 Jul 2017 21:39:16 +0000 (23:39 +0200)
If we mask off any out-of-band bits before we assign to the
variable, then we don't need to clean it up when reading.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Message-Id: <20170718200255.31647-5-rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target/sh4/cpu.c
target/sh4/cpu.h

index 9da7e1ed380bf6daeb7eada6c84ff21d50d2dbd8..8536f6d002a6312908b31ca2d554580b96d4c062 100644 (file)
@@ -39,7 +39,7 @@ static void superh_cpu_synchronize_from_tb(CPUState *cs, TranslationBlock *tb)
     SuperHCPU *cpu = SUPERH_CPU(cs);
 
     cpu->env.pc = tb->pc;
-    cpu->env.flags = tb->flags;
+    cpu->env.flags = tb->flags & TB_FLAG_ENVFLAGS_MASK;
 }
 
 static bool superh_cpu_has_work(CPUState *cs)
index 4aa92d5f30b290b416a6ad00fb01322d09c07de7..a7a6811a8c21e236cb00e2c7616b0683858beecb 100644 (file)
@@ -390,7 +390,7 @@ static inline void cpu_get_tb_cpu_state(CPUSH4State *env, target_ulong *pc,
 {
     *pc = env->pc;
     *cs_base = 0;
-    *flags = (env->flags & TB_FLAG_ENVFLAGS_MASK) /* Bits  0-2 */
+    *flags = env->flags                                        /* Bits  0-2 */
             | (env->fpscr & (FPSCR_FR | FPSCR_SZ | FPSCR_PR))  /* Bits 19-21 */
             | (env->sr & ((1u << SR_MD) | (1u << SR_RB)))      /* Bits 29-30 */
             | (env->sr & (1u << SR_FD))                        /* Bit 15 */