From patchwork Wed Jan 30 17:35:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 10789099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2A7386C2 for ; Wed, 30 Jan 2019 17:43:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1968A2FBDA for ; Wed, 30 Jan 2019 17:43:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DB802FBE4; Wed, 30 Jan 2019 17:43:30 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 913E32FBDA for ; Wed, 30 Jan 2019 17:43:29 +0000 (UTC) Received: from localhost ([127.0.0.1]:41907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gottY-0001Bc-A1 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 30 Jan 2019 12:43:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gotn6-0004gY-N1 for qemu-devel@nongnu.org; Wed, 30 Jan 2019 12:36:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gotn4-00007P-7O for qemu-devel@nongnu.org; Wed, 30 Jan 2019 12:36:47 -0500 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:36878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gotn3-0008LX-VS for qemu-devel@nongnu.org; Wed, 30 Jan 2019 12:36:46 -0500 Received: by mail-pl1-x62c.google.com with SMTP id b5so139199plr.4 for ; Wed, 30 Jan 2019 09:36:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=subject:date:message-id:in-reply-to:references:cc:from:to; bh=z6Oe5++7//00+8jf3KOesDxKK2wIxkTBsez1SGK1Kro=; b=nRfzzAnkouDPf2j8nlOXvdxjBjsytYVjH1HZJbUb0ju2YicxBUsJwJiZX5saYhFdIi /9FGP0Q/WKWeOiiFoeNGIRcRXfgTF0vERsD4Zrwh2ODsy2KXv0kq9g71XJXYR4m/VoAD +6pEYLJ+gAcsSnpbokU0kxIbf7IIQBU1X3pwb8yY2s4ZsWpbOyV16ew4bp+r6vuGWtT7 py91UD67VWu1nDHGvqKtnCePXv97ZS4nnDmIqerlU2Hm3nFsMQALI3tSln43jY+uug+V Wef/bUvp0tUV+QdQVHjw82LRBTVYflX4T4L5klG6ZUAmdmHRikuFfENsSsJgHRiqPcdh 2t0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :cc:from:to; bh=z6Oe5++7//00+8jf3KOesDxKK2wIxkTBsez1SGK1Kro=; b=Aca7Y6YGlsSvESO9bX37Pui+4KPhlxOzqgSyUBUhIFh3dM4O4ZlUQjHm4ahY6x7trC yabm2PdWtKjqKXYh29e6iPwMM4R9/qBpNCBqoDeu33kMWL+e6rEg0S/6gQyPSXPF9K/K Vpi++Dk7iGThEYNKKt9rvUcfVLX6iYrfYgBoob8SkyMyzn/hxqlNSr4hUBroLvIyHxNu 3LgvNdRXcFyFsXutuY1zU1KOf9qmPtc3ZN/vtB9LSd99CCZPByfXPl6IOhk8iKd2E7p7 SMjoeCTuadv9ppWBXef17z0QGQVEoMcZkMF7EH0KxywjNHcjIpuqShiGFGPuzAXZ23wK aLQg== X-Gm-Message-State: AJcUukebp5QZcCg3dingmV+px4Tat0d9zLnFz27z5LBDZCB5g5tWIcAk dRmQEAH27fEoLQ91qqSXw+Go7jr3bfs= X-Google-Smtp-Source: ALg8bN4J+WSLgtuxvl1dk12Eavs0MN5Nv5We4ZUw+8o41tNRGMWfJgpFFYBNvvL8S46Tck1u99dGPw== X-Received: by 2002:a17:902:5a86:: with SMTP id r6mr30174442pli.301.1548869776430; Wed, 30 Jan 2019 09:36:16 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id j21sm3409734pfn.175.2019.01.30.09.36.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Jan 2019 09:36:15 -0800 (PST) Date: Wed, 30 Jan 2019 09:35:52 -0800 Message-Id: <20190130173601.3268-2-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20190130173601.3268-1-palmer@sifive.com> References: <20190130173601.3268-1-palmer@sifive.com> From: Palmer Dabbelt To: qemu-riscv@nongnu.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62c Subject: [Qemu-devel] [PULL 01/10] RISC-V: Split out mstatus_fs from tb_flags 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: Alistair Francis , Michael Clark , Richard Henderson , qemu-devel@nongnu.org, Palmer Dabbelt Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Richard Henderson Signed-off-by: Michael Clark Reviewed-by: Michael Clark Signed-off-by: Alistair Francis Signed-off-by: Palmer Dabbelt --- target/riscv/cpu.h | 6 +++--- target/riscv/translate.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 743f02c8b95a..681341f5d5a4 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -275,8 +275,8 @@ void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env, target_ulong cpu_riscv_get_fflags(CPURISCVState *env); void cpu_riscv_set_fflags(CPURISCVState *env, target_ulong); -#define TB_FLAGS_MMU_MASK 3 -#define TB_FLAGS_FP_ENABLE MSTATUS_FS +#define TB_FLAGS_MMU_MASK 3 +#define TB_FLAGS_MSTATUS_FS MSTATUS_FS static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *flags) @@ -284,7 +284,7 @@ static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc, *pc = env->pc; *cs_base = 0; #ifdef CONFIG_USER_ONLY - *flags = TB_FLAGS_FP_ENABLE; + *flags = TB_FLAGS_MSTATUS_FS; #else *flags = cpu_mmu_index(env, 0) | (env->mstatus & MSTATUS_FS); #endif diff --git a/target/riscv/translate.c b/target/riscv/translate.c index 312bf298b3c2..3d07d651b60c 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -44,7 +44,7 @@ typedef struct DisasContext { /* pc_succ_insn points to the instruction following base.pc_next */ target_ulong pc_succ_insn; uint32_t opcode; - uint32_t flags; + uint32_t mstatus_fs; uint32_t mem_idx; /* Remember the rounding mode encoded in the previous fp instruction, which we have already installed into env->fp_status. Or -1 for @@ -656,7 +656,7 @@ static void gen_fp_load(DisasContext *ctx, uint32_t opc, int rd, { TCGv t0; - if (!(ctx->flags & TB_FLAGS_FP_ENABLE)) { + if (ctx->mstatus_fs == 0) { gen_exception_illegal(ctx); return; } @@ -686,7 +686,7 @@ static void gen_fp_store(DisasContext *ctx, uint32_t opc, int rs1, { TCGv t0; - if (!(ctx->flags & TB_FLAGS_FP_ENABLE)) { + if (ctx->mstatus_fs == 0) { gen_exception_illegal(ctx); return; } @@ -945,7 +945,7 @@ static void gen_fp_arith(DisasContext *ctx, uint32_t opc, int rd, { TCGv t0 = NULL; - if (!(ctx->flags & TB_FLAGS_FP_ENABLE)) { + if (ctx->mstatus_fs == 0) { goto do_illegal; } @@ -1818,8 +1818,8 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) DisasContext *ctx = container_of(dcbase, DisasContext, base); ctx->pc_succ_insn = ctx->base.pc_first; - ctx->flags = ctx->base.tb->flags; ctx->mem_idx = ctx->base.tb->flags & TB_FLAGS_MMU_MASK; + ctx->mstatus_fs = ctx->base.tb->flags & TB_FLAGS_MSTATUS_FS; ctx->frm = -1; /* unknown rounding mode */ }