From patchwork Wed Apr 25 23:45:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Clark X-Patchwork-Id: 10364401 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 CFE8E6038F for ; Thu, 26 Apr 2018 00:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF63A29071 for ; Thu, 26 Apr 2018 00:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD0C1290B9; Thu, 26 Apr 2018 00:01:59 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 0744D290A9 for ; Thu, 26 Apr 2018 00:01:19 +0000 (UTC) Received: from localhost ([::1]:39624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBULf-0008Ky-3H for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Apr 2018 20:01:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBU9j-0005rw-R0 for qemu-devel@nongnu.org; Wed, 25 Apr 2018 19:49:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBU9i-0005ZF-SJ for qemu-devel@nongnu.org; Wed, 25 Apr 2018 19:48:59 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:35730) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fBU9i-0005Z0-MK for qemu-devel@nongnu.org; Wed, 25 Apr 2018 19:48:58 -0400 Received: by mail-pg0-x243.google.com with SMTP id j11so14459620pgf.2 for ; Wed, 25 Apr 2018 16:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tkA9LT+zWlqqtaY1KXDF3/4KHwZ4GouQqTdPtGA5jgs=; b=kb/uE5oWAsqwa8T9XVejizO+gPJ7CoMccvKR12lZstz/PhwvshlzIv06SQRru8XPnv AeBy0j5Wt1/S7nkNcSgQ6oWXLeWW1CQJj49DiuDYeGT1y1jOhAPcIRC0U5oQjVD7ArPA o2PkShvzf9O8nvL8pCMoCjk3DevznEbtcc816Yvl5VQbhM7qwmiS+UXGB91Qy2aUXzjG XJ3Ce5QYhxWOY1NLs3EyWU2siIs6b6sn0j4cyoNK0CLD+T8ExjprahkugJ5Q7vbmtqIy tbEloHAJCu5eJM6k0Wf53kfzdtZzG7nI4y6WvxjWd+OlHZnS6/SmR45qPei/irKOsF8/ vwCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tkA9LT+zWlqqtaY1KXDF3/4KHwZ4GouQqTdPtGA5jgs=; b=eAlQUoV+fNQjzXC751L/rrsTKYM2ZLqcY3s3Cl6TAVcohX2A25A6GuYEao187aUEg2 jS04KQnsYXx0ia+/q6udt8znodQC9PVTquIaCJattV86DG0R1cqIBOBjLKDtqpUJGUZo +aaeE3iPXS5jHSSnu/339MvtW4IgI6/QS1Xtpl6VbNCbdlzBfVkTtGutjG0lkFwDrAB/ ex7Dt0gaxbcsr+epRUNRouW4pJIm6Z7hDvMrk99QsbaToB27al12euCVCA/T/XGkVzOi /ciIB8hKBgNTvxjpkd6Z5oKxe03M0Q9fC86cVJ5hMje2KgUV7yuBxM1/nmPFn5pOkn3g 1vMQ== X-Gm-Message-State: ALQs6tBFX8RRu60NBfYtYQ++PXFwHyvIzB0zsNqhYIV+9uoGLCV1nCV0 SOUOYVwsrGbNbz7lnNpp7u99pPtC3CA= X-Google-Smtp-Source: AB8JxZquC0tkOcPnnZ4t3b9Stp87RJCfcz7q8aDM7ACEroPZQz7QAyHNA0Afnw/dRoqh5Q2YQaV3QQ== X-Received: by 2002:a17:902:7488:: with SMTP id h8-v6mr5638711pll.124.1524700137670; Wed, 25 Apr 2018 16:48:57 -0700 (PDT) Received: from localhost.localdomain (122-58-167-38-fibre.bb.spark.co.nz. [122.58.167.38]) by smtp.gmail.com with ESMTPSA id e10sm29577549pfn.67.2018.04.25.16.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Apr 2018 16:48:57 -0700 (PDT) From: Michael Clark To: qemu-devel@nongnu.org Date: Thu, 26 Apr 2018 11:45:33 +1200 Message-Id: <1524699938-6764-31-git-send-email-mjc@sifive.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1524699938-6764-1-git-send-email-mjc@sifive.com> References: <1524699938-6764-1-git-send-email-mjc@sifive.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PATCH v8 30/35] 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: Sagar Karandikar , Bastian Koppelmann , Palmer Dabbelt , Richard Henderson , Michael Clark , Alistair Francis , patches@groups.riscv.org 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 Cc: Sagar Karandikar Cc: Bastian Koppelmann Cc: Palmer Dabbelt Cc: Alistair Francis Cc: Richard Henderson Signed-off-by: Michael Clark --- 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 3fed92d..6fb0014 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -270,8 +270,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) @@ -279,7 +279,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 c0e6a04..4180c42 100644 --- a/target/riscv/translate.c +++ b/target/riscv/translate.c @@ -43,7 +43,7 @@ typedef struct DisasContext { target_ulong pc; target_ulong next_pc; uint32_t opcode; - uint32_t flags; + uint32_t mstatus_fs; uint32_t mem_idx; int singlestep_enabled; int bstate; @@ -664,7 +664,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; } @@ -694,7 +694,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; } @@ -985,7 +985,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; } @@ -1863,8 +1863,8 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb) ctx.tb = tb; ctx.bstate = BS_NONE; - ctx.flags = tb->flags; ctx.mem_idx = tb->flags & TB_FLAGS_MMU_MASK; + ctx.mstatus_fs = tb->flags & TB_FLAGS_MSTATUS_FS; ctx.frm = -1; /* unknown rounding mode */ num_insns = 0;