From patchwork Wed Feb 13 15:44:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 1041352 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="h+lk7J0Z"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4403m46mMgz9s4Z for ; Thu, 14 Feb 2019 02:46:26 +1100 (AEDT) Received: from localhost ([127.0.0.1]:58826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtwjr-0002Aq-NO for incoming@patchwork.ozlabs.org; Wed, 13 Feb 2019 10:46:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtwiw-000271-N7 for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:45:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtwiq-0006iR-PM for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:45:20 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:38956) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtwio-0006Tw-VU for qemu-devel@nongnu.org; Wed, 13 Feb 2019 10:45:16 -0500 Received: by mail-pl1-x634.google.com with SMTP id 101so1334260pld.6 for ; Wed, 13 Feb 2019 07:45:04 -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=h+lk7J0Zuqo/fqzGjYXn2ti5u1ogn67XWLUZm/JuR4/6TX5ezpTHaj3rfsjff0Ieny K3JIUG7SQ1uB1EmZalef6C4nfndLBJEXc+vp9pEi2XUGf1au9W9ykOFpBUKJHLzNNEYx tiEpZAzKC0xI8xoyXiVi2nb95LNBxp6d9ElfmBmKHzL7muPw7h9b4/6F73M8Qy8Nfn1W y8qDwCiORj1ftgpJaYnETKNp2y5Tup3jQPQ5vvtEHuJSvic3qbZ+33HLENgmNPqDhdF2 CBgU2tLn3kOkhGu5LvXbV2Rp3FbFCQSN0Mgqyt7T+vqvXaH4G4loMgXlM99oS/oOJEuh i2Iw== 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=ep7vmUIN7IUtc2MqS1zqHrRDLoQ4s87mifgl9aTnJ4AVvED7ShzbG3rVorAcERxgYT YvBaMezOGrwhNZ48BsBo20l5U+4mojnXWOu4zn/W5AEWC9BCPibXsqkLxkhW71vwhRID 1u3jeD4RRpxKZCXcL+YsTBInGeqZAiDeEmuUFOX3XVZgc0yHD2/hyK+1KtroEyr9LPbV LKNXqwLNzhzAIyABKdrxGMkpK1svmcFfeODpq4HgUQiWvm8L1uxcSuE2OxROleHz1oRp 2g3tyWOAq4X2Kw4qRv5WfuYWrLzusFCRsAbIYWxZ7NcGgzx6fhqW3OhWg8M8yZYUVVpq 1Bjw== X-Gm-Message-State: AHQUAuYEFM2bkkNgltT95xdFmiHZQ7TbjO83B0KSGlapkU440rZnFfa4 DsDC5/0hTmpTw25/GIhBD/7Hkw== X-Google-Smtp-Source: AHgI3IYb7rcinBuPlrBBGge0gF/ByJpeV4P2m0cPEO900DBqb7Trzw5PIFucGv5S9zHp8ko5k24TAg== X-Received: by 2002:a17:902:bc89:: with SMTP id bb9mr1160839plb.212.1550072703450; Wed, 13 Feb 2019 07:45:03 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id d88sm29393174pfe.19.2019.02.13.07.45.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 07:45:02 -0800 (PST) Date: Wed, 13 Feb 2019 07:44:40 -0800 Message-Id: <20190213154450.14749-2-palmer@sifive.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20190213154450.14749-1-palmer@sifive.com> References: <20190213154450.14749-1-palmer@sifive.com> From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::634 Subject: [Qemu-devel] [PULL 01/11] 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: qemu-riscv@nongnu.org, Palmer Dabbelt , Richard Henderson , qemu-devel@nongnu.org, Michael Clark , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 */ }