Received: from eggs.gnu.org ([2001:4830:134:3::10]:49570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXYig-00064b-H2 for qemu-devel@nongnu.org; Tue, 18 Jul 2017 16:03:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXYif-0004Tv-Nj for qemu-devel@nongnu.org; Tue, 18 Jul 2017 16:03:46 -0400 Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:32933) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dXYif-0004Tm-JI for qemu-devel@nongnu.org; Tue, 18 Jul 2017 16:03:45 -0400 Received: by mail-qk0-x241.google.com with SMTP id u126so2854708qka.0 for ; Tue, 18 Jul 2017 13:03:45 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Tue, 18 Jul 2017 10:02:29 -1000 Message-Id: <20170718200255.31647-5-rth@twiddle.net> In-Reply-To: <20170718200255.31647-1-rth@twiddle.net> References: <20170718200255.31647-1-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v3 04/30] target/sh4: Keep env->flags clean List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aurelien@aurel32.net 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é Reviewed-by: Aurelien Jarno Signed-off-by: Richard Henderson --- target/sh4/cpu.h | 2 +- target/sh4/cpu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/sh4/cpu.h b/target/sh4/cpu.h index 240ed36..6d179a7 100644 --- a/target/sh4/cpu.h +++ b/target/sh4/cpu.h @@ -391,7 +391,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 */ diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 9da7e1e..8536f6d 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -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) -- 2.9.4