From patchwork Fri Aug 28 14:19:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 248559 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp1141569ilg; Fri, 28 Aug 2020 07:42:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiSEzKXvRSaasqS2ELXOnuwD4f1qQsiIJGtK5c8l2dEMYySkeH2hehB4pON5O8hpgximzB X-Received: by 2002:a25:5094:: with SMTP id e142mr2744902ybb.99.1598625757380; Fri, 28 Aug 2020 07:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598625757; cv=none; d=google.com; s=arc-20160816; b=TZ0FyPEgQIwa0PkAXdARgktprmU9V5GXY0c7NJhIll4jcjyGtkKq34e3mwYFcmWExg t/t/HnnEY2nBx7xQrL85btHA6jENiB6q6o03tBuPpOS/2AHFOvW45KeVE/SPlZ5SWnXy CZte2JUmlHMpgamOQ/od3NZE1J2OLHQn3/G+ocs+/QGUC/eiYhKVU+auFZRM0gwKx1mH NHGUzASb+8mVPxQKjYiLJ4kazmDNinMrXbejaXaa5SFbF/NzBMEXOQ+wvjCTf78x26db +Zc1QE55DVXVUS7Jd8HrwDGD9uKvBkE0p0stFO2al7AU8UPD0RlevF1yHZFJeuw80I7B yrYA== 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=iiLlNgJrdHfhscp1aVBO6P+kxbA4/R9Ha0WeuU0s3+0=; b=Y9Wjnoyh2SbJVqu+bJSDsGmFsgTCghAL3rU8xR4kqQn2fZo5ltwvyN2nw+6jg9CI36 Vc/w+Qc0BZOxF2cuSMrztbKXNalwH3UiMYPt6WVP4uxacXjoZ/lcLBiAs72FloWl8css FG3MjhxVPhfLXgQZLf8HdnkwxiCJnUVnnf/G5uL2IIq3XllzRP6QSRYSUaLuHHX/z87O SSWlh1WghUXY4TnyKaSiOWk0X7kr0zn4meHz1DqJ5QoskVHwHtHDzeD0V+0K53G3MK9T E9OBQL2PJORYqvQf5w37W26GZdCqfHajHln3uyKbmjZPzWW3/Xq12ekdGMSO/g6cQMpi gfmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X517tc+H; 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=pass (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 d192si1050494ybf.426.2020.08.28.07.42.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Aug 2020 07:42:37 -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=pass header.i=@linaro.org header.s=google header.b=X517tc+H; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBfaO-0003EU-Or for patch@linaro.org; Fri, 28 Aug 2020 10:42:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBfFC-0001bP-VD for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:43 -0400 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:52179) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBfF7-0005I2-ET for qemu-devel@nongnu.org; Fri, 28 Aug 2020 10:20:42 -0400 Received: by mail-pj1-x1043.google.com with SMTP id ds1so565600pjb.1 for ; Fri, 28 Aug 2020 07:20:37 -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=iiLlNgJrdHfhscp1aVBO6P+kxbA4/R9Ha0WeuU0s3+0=; b=X517tc+HzAIdyUpQ/iplzhqDa1de+HN8MW/TrII1EAB47ANYFjK2umcBdntbxUf8zJ sIyXrl3X2wc1OAvUyp+HVKu1ZdgWznU8jm1QD8K42mdyVd0Lz2uT4R5ZCwbj/cogjLU3 iDUBKrLlPJS2dEKp0mUbS671hNKaOb3mPPPq1OWg3vEfBID+L0+RkKp9zOHblLgbZZcV nu0zJXsnYP5/XRucsviWwIKeT7UAQfB0BcQLoXRIxsODa1kX4wWBbVFbj2+syfMzea/G p8JVkoK2qw0aEM6rGnlE8vj4M8+h/4cCVueIMzKAtnfM5pEFnImh68UmTHaDervcpC/j oNcA== 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=iiLlNgJrdHfhscp1aVBO6P+kxbA4/R9Ha0WeuU0s3+0=; b=T6wVlR/nhnanSptM3Lz9SPD+YtOWD3azNQU+R9jnzYLfudWBwwHNi8YzX1AFUW8/QC VBoGDTa9KTymA8yTlOFDscwnuPd5iWTeNahNdy6RRWiC1pzAqSQp5783bSIoXVOG3bXH hPUUzY8wWXpMIvYliliZNriStxGlNF2sV6MkPm8ZHelBA8CA6Nup9HwGDsvM1gEMEaDV y81xEHbGOKscXeYsdv47AqXSZ6jeHma8VBsI88HypcZMkHBO5soRjb2YSXD1hHdNYpf7 v39uWyEEEPObaooV0AVp2+UE9MGpFXNvP5roLsnYJHv49OzhV/d5ZYiK+Wursr9PhfCY fHfA== X-Gm-Message-State: AOAM531YBuNjOn9VyRcorax8+8PT1KaUzidPrZngf4tJunI5YE02u9XE GnO2xqRocpp6ZJgxh6NQc4pj50QV7wW/1A== X-Received: by 2002:a17:90b:4d0d:: with SMTP id mw13mr1362668pjb.43.1598624435943; Fri, 28 Aug 2020 07:20:35 -0700 (PDT) Received: from localhost.localdomain ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id j3sm1403080pjw.23.2020.08.28.07.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 07:20:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 51/76] target/microblaze: Cache mem_index in DisasContext Date: Fri, 28 Aug 2020 07:19:04 -0700 Message-Id: <20200828141929.77854-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200828141929.77854-1-richard.henderson@linaro.org> References: <20200828141929.77854-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1043; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1043.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.iglesias@xilinx.com 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. 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);