From patchwork Fri Jul 7 02:20:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9829387 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 46119602CA for ; Fri, 7 Jul 2017 02:28:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 331EB27FB7 for ; Fri, 7 Jul 2017 02:28:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27DAE283AE; Fri, 7 Jul 2017 02:28:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC8EF27FB7 for ; Fri, 7 Jul 2017 02:28:08 +0000 (UTC) Received: from localhost ([::1]:54125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTJ04-0005HQ-1s for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Jul 2017 22:28:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dTIuD-00013B-GU for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:22:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dTIuA-0007qC-Ce for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:22:05 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dTIuA-0007pq-8D for qemu-devel@nongnu.org; Thu, 06 Jul 2017 22:22:02 -0400 Received: by mail-qk0-x244.google.com with SMTP id p21so2754640qke.0 for ; Thu, 06 Jul 2017 19:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5A0sQrj7ARgjxmzMPYKPo82mYmR9VxpK/7KKrxoW8Cg=; b=nvbtD8Hq/67fMYmtdSW1+DN5x/J+h7bdqp/AAMZsBsOwjDbv+If0FbnfQ9zwFtFRun ky8OyvGu6nC7ylAsUcIzNsH2yrAE67gfaFQzc3fcBfkO2eZ7KRlRg04x2zz3wu9GAbmZ 7BeJMtJ31xSFTG1re7gUv8YzNHLHfMd+xu4W9dkKQm205BcNAFigMLZIPKSivozQQyMv Q8D3ld8NpktxE5LmXzGP3E0hS3Cx+M01Is992oUScBSEoH2eP1RANv+L1fA6Jy/oDCHz f+THV44jv36/AUGl2gr51crrsZU/twpLFmxc3zcL3E2FZeSQjiVCsdkjqkmmsaQHOH1A 3t9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5A0sQrj7ARgjxmzMPYKPo82mYmR9VxpK/7KKrxoW8Cg=; b=HqWxT7BWTMwexXfwkZaMwKHKWbBLZKxnB6TYOoQfW0iFqxk24C050PrC9LUPI3mO0N Upvjh2lnzdOZvykURMVIRp5dikpZjctFxqt7dW2v7SPrExro7syBWiDadWbIEgc5tofi JNde2wGtZ/ySSpoc/spJVz626p8KJItPsJIPdaC+WhxbLEJWTrpFjwbVgSFW51W2RR7G rwz6wk/jgc3RtkfeUMpeXh1ZKDziYCNCmzR1tkdp0EVrBLkcJacy7iItRbZef5iyiHTV DIXsZ1onibOuZXkTkeLK5ErzEPwG3E4m77t+0sUHT1VhgDx/PpRHjMvIoRzhOtZqLaGD GPcg== X-Gm-Message-State: AKS2vOwlRkNoa3XJWiKboAZzuyTQZp5u947CN+JmMRp3nH8+iVMuyPOf Ulj+oAg4jGZVG8fxvvg= X-Received: by 10.55.55.6 with SMTP id e6mr60639216qka.72.1499394121630; Thu, 06 Jul 2017 19:22:01 -0700 (PDT) Received: from bigtime.twiddle.net.com (rrcs-66-91-136-156.west.biz.rr.com. [66.91.136.156]) by smtp.gmail.com with ESMTPSA id i85sm1407176qke.66.2017.07.06.19.21.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Jul 2017 19:22:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 6 Jul 2017 16:20:48 -1000 Message-Id: <20170707022111.21836-5-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170707022111.21836-1-rth@twiddle.net> References: <20170707022111.21836-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PATCH v2 04/27] target/sh4: Keep env->flags clean X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bruno@clisp.org, laurent@vivier.eu, aurelien@aurel32.net, glaubitz@debian.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Richard Henderson Reviewed-by: Aurelien Jarno Reviewed-by: Philippe Mathieu-Daudé --- 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)