From patchwork Tue Jul 18 20:02:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9849405 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 D2E69600CC for ; Tue, 18 Jul 2017 20:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 443FE1FFF9 for ; Tue, 18 Jul 2017 20:05:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3928A203B9; Tue, 18 Jul 2017 20:05: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 B36DC1FFF9 for ; Tue, 18 Jul 2017 20:05:08 +0000 (UTC) Received: from localhost ([::1]:58348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXYk0-000674-23 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Jul 2017 16:05:08 -0400 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) 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 :mime-version:content-transfer-encoding; bh=3v3p3oavXYoM226wn4LS5Zyx6sX+H0A+aIiMpHlXrlg=; b=Tg7fhFC3iWjWVwU+53GfkB4WACD4jOd20CxDNvMyE/PtZXKXa5+SWGuWJzUgf1UUm/ itwfQJ/MigqFmAALHevubRRgCdDJqBtlnud98S2tr6XRKUpFeBzESbLjPTmVW23fXFLG h3GJ3bnt+APb926NI5qH1yUc6sp24bgOxkZ0CG7illpOf/1L3w3fOLeGTvPIMmXiRNUY UGETWIrzISguOrLIDndgpRTNLZe/nPq74P9Wmqg64ijkpFOHZtkb54U45ixZRN1DDrIg yUXGcs13/lMBX3zoo2rji8FlUbCXIjBUNVm90WZ9wkIuJrS5VRZlq4aHknxWryu5jFai bDJA== 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:mime-version:content-transfer-encoding; bh=3v3p3oavXYoM226wn4LS5Zyx6sX+H0A+aIiMpHlXrlg=; b=NkDPJ25udZQEf1BCPH96HXs8kdvnIfhWFyaOU9wwa7gGJKRLS6f77GHxPAky1iwxo2 jF3vimX8MQraZ+yQBwE7JYplgaQtY7naG0K8/POo8wymz3m+jCtO+sA8aVsjddpGm/vh 3qh3kJzTsYaZ4Ifq5bIXtGInJxAQ/ZGVUQ4sMjq347hNbijViDxD+SpaIu5frm6UzvJu FiroN04C+yTpaT2u4ERfD8dIzqJf4OwvGfahdslizyakH9CP3duOpdcWdNRl1MH/MrFL 1kAt2K/0Z9OUl0cAvGqgMTz30OzuNVGNGdbR4efaBkCu9JCXXHlIF8MUeNAzghkfy7HN Nk2g== X-Gm-Message-State: AIVw1124xZPY/si5Yd9G0uGPYYXTdteNQLkN72i8vdDy8pW9xN009Yjb +QT2aWg5Od3wor6jS3g= X-Received: by 10.55.7.7 with SMTP id 7mr3947724qkh.121.1500408224708; Tue, 18 Jul 2017 13:03:44 -0700 (PDT) Received: from bigtime.com ([101.165.234.197]) by smtp.gmail.com with ESMTPSA id b201sm2339817qkg.5.2017.07.18.13.03.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Jul 2017 13:03:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 18 Jul 2017 10:02:29 -1000 Message-Id: <20170718200255.31647-5-rth@twiddle.net> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170718200255.31647-1-rth@twiddle.net> References: <20170718200255.31647-1-rth@twiddle.net> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::241 Subject: [Qemu-devel] [PATCH v3 04/30] 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: aurelien@aurel32.net 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. 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)