From patchwork Mon Sep 7 18:04:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 249258 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3894831ilg; Mon, 7 Sep 2020 11:12:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRNAU31fyXBpuGlGmVoLDxp8Xh4DVymD4R2A1r4qJXmtdvIggS5u0rF/kwecBaagT8noDd X-Received: by 2002:a25:5808:: with SMTP id m8mr29764948ybb.246.1599502338340; Mon, 07 Sep 2020 11:12:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599502338; cv=none; d=google.com; s=arc-20160816; b=KSOIpx70ujVOV61VsXPJsg4acihp6jgGWyWuOnGnyWdtuEdhsLMJ09XG5o9R52SUOg FI03xIhQ6LjiRSgPjq54uof4SqSbg4C3EIde6CFO9W5zRrsT555d43L+AvuTTvWQXdBs 1GAip/tkQMxHU+j9k4ySGKAFnP31nRsi09qMKwbCFKBeNEQWQ6lKWerpYaufgS9JUtr1 ckEd+oh6N8rmrkcIKgQcHWzB1mAT4Wa0nPu3T9gnsqbCCDhJp6KHqERcuyR45o9eBFfD X63Yf85VVCqFtKQK1kWKFJHZzIMNti8DAI4cdwzd3+kAZS2z3VyLChBZJK278ncz0wvh 9wkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=mCgjeXLmeN5hMfhXUcUPxa4AMIlfBZL76Mf1qDfxbvQ=; b=rAQs97favUIGTLckG/eCaGl49r8awvqIs98f1O5UDroHvxS/XPeAlqzLtIu/R9WT4I T4aVPKJCrNniaujuTNtiOGUbjs1tEteOhH83UomyjSRSLSU+1TYoeKGO+70wroVFaB+U 4QA0LYNxJz6GzH2BiZaFAkJY6ORfP8P7vr8YyMdbpUur2Vye3K44pGRpLWtRZnXpgHp9 c5dHCYqdLWi/8EiAB92JdrIT0N3QYHnVSPfDhr4VzAajlCY+iaa2K5xhxjPMG5PfK2Ef 0m3svH3TZKg37aLeezt0z2A1SGguncY533uQ7uPNAni9uddvE6+roSlsNzNK4zJkKWSb lqeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zMVbP3oL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u2si13408521ybu.41.2020.09.07.11.12.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Sep 2020 11:12:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zMVbP3oL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFLcn-0005OC-Rr for patch@linaro.org; Mon, 07 Sep 2020 14:12:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFLVz-0003vF-FT for qemu-devel@nongnu.org; Mon, 07 Sep 2020 14:05:15 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:38327) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFLVx-0002Ok-IM for qemu-devel@nongnu.org; Mon, 07 Sep 2020 14:05:15 -0400 Received: by mail-pf1-x435.google.com with SMTP id l126so1934908pfd.5 for ; Mon, 07 Sep 2020 11:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mCgjeXLmeN5hMfhXUcUPxa4AMIlfBZL76Mf1qDfxbvQ=; b=zMVbP3oLWWgFM30PnOzJp2LqHHxqM/KwiridqzGv5Iezku2MXp5uQGack/MQbdp8C/ ZRmV0xJPJJHAPYFuKg6MHHZaBMv0IpFdpEeW6uzq7m03LMQCkq+1DMrGzM3BeB8+9+7+ 6YxaaYRo3k4G9K/w43SOR8odFpHEcW8WGy6U15yYF9kXvIhmvubPKZ4jSZfPjB8wjjn0 OLBDeHijSpQjSucxuTY0tQXAwuAcuPuOmtitV8IrWJGJ751rk3UxvOxGE5zf0GzC/cvd 202hTyOdpF7V50ng2NrZeIiEZWLMfSVUexL4t3e1a7WfnKVb5hozmhSrQk8UZVxRIQHF fjKA== 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:mime-version:content-transfer-encoding; bh=mCgjeXLmeN5hMfhXUcUPxa4AMIlfBZL76Mf1qDfxbvQ=; b=IGQIRiTPhXs7EZXLFwyldRVoad2Uu6fgkmI49cbyGOSzzPVjPI3GTeYYPA6DcHIaxt 5+Foj+CO7byOaVYd4XNPts/Q/CYGc0i29dM09dqT20+VtmSTUrglAfeLG71tSc6YNYRv UKSBgSBJusC+b1QtUmBylR3FYQW8anXyUcIxbptz0huhCMZqc6yxxXhHMrPBGv3fqkKz Gz9V5Sk9Gj3UdrWXklCKo5hKME7/TLVXA8oOP21sYTIQ6jnkD+5F0uUSonk91Vmi0tOv aWc4o/Mji2ygy+NytkuCwKatpQJsZxLO4tGeSRSilINr5K92IMqFaYAO8KVcxNVZXYuN +/gw== X-Gm-Message-State: AOAM531S6DH2lQA8el9pMTcOa1yrxOVUayl08G4Q1GY2aSRMqSgnJWle bdx1HBuIxu5cjioLHhwp8PF5J0uePDnQ8A== X-Received: by 2002:aa7:9aef:: with SMTP id y15mr671228pfp.119.1599501911800; Mon, 07 Sep 2020 11:05:11 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id v6sm11367768pfi.38.2020.09.07.11.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 11:05:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/19] target/microblaze: Put MicroBlazeCPUConfig into DisasContext Date: Mon, 7 Sep 2020 11:04:58 -0700 Message-Id: <20200907180459.29025-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200907180459.29025-1-richard.henderson@linaro.org> References: <20200907175102.28027-1-richard.henderson@linaro.org> <20200907180459.29025-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Edgar E . Iglesias" , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The bulk of the translator should not have access to the complete cpu state, to avoid the temptation to examine bits that are in run time, but not translation time context. We do need access to the constant cpu configuration, and that is sufficient, so put that into DisasContext. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) -- 2.25.1 diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index eca422b3db..abfcc7e6c8 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -60,7 +60,7 @@ static TCGv_i32 cpu_res_val; /* This is the state at translation time. */ typedef struct DisasContext { DisasContextBase base; - MicroBlazeCPU *cpu; + const MicroBlazeCPUConfig *cfg; /* TCG op of the current insn_start. */ TCGOp *insn_start; @@ -159,7 +159,7 @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) static bool trap_illegal(DisasContext *dc, bool cond) { if (cond && (dc->tb_flags & MSR_EE) - && dc->cpu->cfg.illegal_opcode_exception) { + && dc->cfg->illegal_opcode_exception) { gen_raise_hw_excp(dc, ESR_EC_ILLEGAL_OP); } return cond; @@ -291,7 +291,7 @@ static bool do_typeb_val(DisasContext *dc, arg_typeb *arg, bool side_effects, #define DO_TYPEA_CFG(NAME, CFG, SE, FN) \ static bool trans_##NAME(DisasContext *dc, arg_typea *a) \ - { return dc->cpu->cfg.CFG && do_typea(dc, a, SE, FN); } + { return dc->cfg->CFG && do_typea(dc, a, SE, FN); } #define DO_TYPEA0(NAME, SE, FN) \ static bool trans_##NAME(DisasContext *dc, arg_typea0 *a) \ @@ -299,7 +299,7 @@ static bool do_typeb_val(DisasContext *dc, arg_typeb *arg, bool side_effects, #define DO_TYPEA0_CFG(NAME, CFG, SE, FN) \ static bool trans_##NAME(DisasContext *dc, arg_typea0 *a) \ - { return dc->cpu->cfg.CFG && do_typea0(dc, a, SE, FN); } + { return dc->cfg->CFG && do_typea0(dc, a, SE, FN); } #define DO_TYPEBI(NAME, SE, FNI) \ static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ @@ -307,7 +307,7 @@ static bool do_typeb_val(DisasContext *dc, arg_typeb *arg, bool side_effects, #define DO_TYPEBI_CFG(NAME, CFG, SE, FNI) \ static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ - { return dc->cpu->cfg.CFG && do_typeb_imm(dc, a, SE, FNI); } + { return dc->cfg->CFG && do_typeb_imm(dc, a, SE, FNI); } #define DO_TYPEBV(NAME, SE, FN) \ static bool trans_##NAME(DisasContext *dc, arg_typeb *a) \ @@ -683,7 +683,7 @@ static TCGv compute_ldst_addr_typea(DisasContext *dc, int ra, int rb) tcg_gen_movi_tl(ret, 0); } - if ((ra == 1 || rb == 1) && dc->cpu->cfg.stackprot) { + if ((ra == 1 || rb == 1) && dc->cfg->stackprot) { gen_helper_stackprot(cpu_env, ret); } return ret; @@ -703,7 +703,7 @@ static TCGv compute_ldst_addr_typeb(DisasContext *dc, int ra, int imm) tcg_gen_movi_tl(ret, (uint32_t)imm); } - if (ra == 1 && dc->cpu->cfg.stackprot) { + if (ra == 1 && dc->cfg->stackprot) { gen_helper_stackprot(cpu_env, ret); } return ret; @@ -712,7 +712,7 @@ static TCGv compute_ldst_addr_typeb(DisasContext *dc, int ra, int imm) #ifndef CONFIG_USER_ONLY static TCGv compute_ldst_addr_ea(DisasContext *dc, int ra, int rb) { - int addr_size = dc->cpu->cfg.addr_size; + int addr_size = dc->cfg->addr_size; TCGv ret = tcg_temp_new(); if (addr_size == 32 || ra == 0) { @@ -772,7 +772,7 @@ static bool do_load(DisasContext *dc, int rd, TCGv addr, MemOp mop, if (size > MO_8 && (dc->tb_flags & MSR_EE) && - dc->cpu->cfg.unaligned_exceptions) { + dc->cfg->unaligned_exceptions) { record_unaligned_ess(dc, rd, size, false); mop |= MO_ALIGN; } @@ -918,7 +918,7 @@ static bool do_store(DisasContext *dc, int rd, TCGv addr, MemOp mop, if (size > MO_8 && (dc->tb_flags & MSR_EE) && - dc->cpu->cfg.unaligned_exceptions) { + dc->cfg->unaligned_exceptions) { record_unaligned_ess(dc, rd, size, true); mop |= MO_ALIGN; } @@ -1325,7 +1325,7 @@ DO_RTS(rtsd, 0) static bool trans_zero(DisasContext *dc, arg_zero *arg) { /* If opcode_0_illegal, trap. */ - if (dc->cpu->cfg.opcode_0_illegal) { + if (dc->cfg->opcode_0_illegal) { trap_illegal(dc, true); return true; } @@ -1658,7 +1658,7 @@ static void mb_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); int bound; - dc->cpu = cpu; + dc->cfg = &cpu->cfg; dc->tb_flags = dc->base.tb->flags; dc->ext_imm = dc->base.tb->cs_base; dc->r0 = NULL;