From patchwork Mon Aug 31 16:05:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248806 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp3458585ilg; Mon, 31 Aug 2020 09:29:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/4kBwhFcvFr7i6A2yFpfD0RZs4YaFqhkP+ULSqfuQR5UxqkbcSVcFmLbiSGEoqG5RIvRE X-Received: by 2002:a1f:bd15:: with SMTP id n21mr1773853vkf.16.1598891398977; Mon, 31 Aug 2020 09:29:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598891398; cv=none; d=google.com; s=arc-20160816; b=VIqscZlpspv8QMzv2fCSqH7Cq+g2nGm1yGILV8vrtpy2e/uqkIAffH9rAvlNbV8umv 4JPFR0Q6H0oVvVAshvHcSBmUgFuwruk2cJBoapRzuasgC0ktDBHcJ7YXlGVsUcIqxE5M wNnLqoXYWMdGLR9psGtNKDkC3P5HY1K3xaZ36eeetxjSqZXoamFMaJ+gTDmdDI7ugBCW 32p5cW8+iuKFyuXQEseceH7BurKoO5WRg6YF9ii1vmpUG5lFidqfMTLYhnX15k4i5loj sjFu+/Zj8Bso/oyhdBoTvbEmSFO3ugDwoKjHOiSWeLoTfhhICK7luc/gE2yM+RmJHQNe l4mg== 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=pM4ivWigF6aGuCdn4jvlwQnVJrMGcBGI733lqrG0wt8=; b=yO7hFhd4udDqT3u3VWI14zx/774IGSg7L6RP8ir3r9gDMuv0ZR1sIkduu0imHntp1y MnmGoB5cEDdSzI0625GIMSrhvp4iH/9hkZ4wB2qjEcv4VeVrPTlukk+cSIPoENIwSBK5 JD/gnLE+Pav8ofOpsUrtEgm1hvBK4m4MON3WfuRvaysSAB/8wo3piEuz9NjWFOJKYM/n HS/gGg9XuMY6kmdoJfk29XNlNRz92KnB22wGyiMLpbDipgQap8/V1s1LVR7a3LKz8n0G ZFo+KGzwnFAL5s/QxGVyo0EfZyt/M3BmH6jRFFdnfZWHo4saBgAiLauqbRiwQJxUpVTf 8ccg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="eo0V4/Vt"; 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 c12si831635vso.153.2020.08.31.09.29.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 31 Aug 2020 09:29:58 -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="eo0V4/Vt"; 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]:34624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCmgw-0003Lx-9E for patch@linaro.org; Mon, 31 Aug 2020 12:29:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCmKy-0005nh-GY for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:16 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:46350) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCmKw-00065v-Mn for qemu-devel@nongnu.org; Mon, 31 Aug 2020 12:07:16 -0400 Received: by mail-pg1-x531.google.com with SMTP id 31so821100pgy.13 for ; Mon, 31 Aug 2020 09:07:14 -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=pM4ivWigF6aGuCdn4jvlwQnVJrMGcBGI733lqrG0wt8=; b=eo0V4/VtOHM1WLUX8u1mPPtH4HcbQbO93GYkPjuc14JcxAKyPyGhWEnWE6Jg8m2lCe hzucK6vnsoY4UvHNCz0OBNTzuhqu3aUdAizlGcMdLUXHjsAcTv9ooOw6oZu6/WsR4DW5 VLQ02C6BdUvf2Mr0vF+6xkhouKPOpTAA3iIZ23gjJs2+vFg1kYGbyqNWwAGgisH8YT7H 94leYBUkLp96J/PfpmL9iy5YQTAtTwELumMYYrsXiDHItoiUp+49+kedSr6Pworb+A4T NvnhH2x6I+H3HGabPGsAWDm3fmJQ1Y4IqLQf0h78ztsrZQcUxlZWVtVPErBNjf6c5NtV oZ2g== 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=pM4ivWigF6aGuCdn4jvlwQnVJrMGcBGI733lqrG0wt8=; b=PNOgTakZbNg4Ay2cGrpSdZ/+e9CTrvraCjJ3yAk2ts9Hdhy+mna92Aw9TsQ0tEE+d6 X38OK6sCD7mMxudwmY4c5fq46yKz180p/qPAnZwvp7ZVNuhReDfUfSWxfhr5KNSis4cs zWxRu5BYCh9YTlygmtF6jIjPmTm1QnismhFK626Hc1PKTnKyb0zcOaFjOMRFMIBNSuvs i/GDlVoqkuHZwXH/xakRvAkPDXTGoUjM17nA0svzYuCrgWj27nwvrdAFeqWcbKtvLs5A Y/kRRHJ8rQpTWpflrca+z/TtBPM+EbhzbQ7WzpvUMq/z/RY1mI4ynhKBovqW01/ziOsj YEuA== X-Gm-Message-State: AOAM533EUwCC320kXcSeOhZsuHGrdnKwxdjsPZ9KcZRZeIEIQZdszT4D HPv7kdcLmoashw8mCDAs0jaTynZxvmoXbg== X-Received: by 2002:a62:406:: with SMTP id 6mr1762033pfe.193.1598890032881; Mon, 31 Aug 2020 09:07:12 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id gt13sm17218pjb.43.2020.08.31.09.07.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 09:07:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 51/76] target/microblaze: Cache mem_index in DisasContext Date: Mon, 31 Aug 2020 09:05:36 -0700 Message-Id: <20200831160601.833692-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831160601.833692-1-richard.henderson@linaro.org> References: <20200831160601.833692-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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" Ideally, nothing outside the top-level of translation even has access to env. Cache the value in init_disas_context. Tested-by: Edgar E. Iglesias Reviewed-by: Edgar E. Iglesias Signed-off-by: Richard Henderson --- target/microblaze/translate.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c index 1f6731e0af..a55e110171 100644 --- a/target/microblaze/translate.c +++ b/target/microblaze/translate.c @@ -73,6 +73,7 @@ typedef struct DisasContext { unsigned int delayed_branch; unsigned int tb_flags, synced_flags; /* tb dependent flags. */ unsigned int clear_imm; + int mem_index; #define JMP_NOJMP 0 #define JMP_DIRECT 1 @@ -175,8 +176,7 @@ static bool trap_illegal(DisasContext *dc, bool cond) */ static bool trap_userspace(DisasContext *dc, bool cond) { - int mem_index = cpu_mmu_index(&dc->cpu->env, false); - bool cond_user = cond && mem_index == MMU_USER_IDX; + bool cond_user = cond && dc->mem_index == MMU_USER_IDX; if (cond_user && (dc->tb_flags & MSR_EE)) { gen_raise_hw_excp(dc, ESR_EC_PRIVINSN); @@ -968,7 +968,7 @@ static void dec_load(DisasContext *dc) TCGv addr; unsigned int size; bool rev = false, ex = false, ea = false; - int mem_index = cpu_mmu_index(&dc->cpu->env, false); + int mem_index = dc->mem_index; MemOp mop; mop = dc->opcode & 3; @@ -1077,7 +1077,7 @@ static void dec_store(DisasContext *dc) TCGLabel *swx_skip = NULL; unsigned int size; bool rev = false, ex = false, ea = false; - int mem_index = cpu_mmu_index(&dc->cpu->env, false); + int mem_index = dc->mem_index; MemOp mop; mop = dc->opcode & 3; @@ -1540,6 +1540,7 @@ static void mb_tr_init_disas_context(DisasContextBase *dcb, CPUState *cs) dc->ext_imm = dc->base.tb->cs_base; dc->r0 = NULL; dc->r0_set = false; + dc->mem_index = cpu_mmu_index(&cpu->env, false); bound = -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; dc->base.max_insns = MIN(dc->base.max_insns, bound);