From patchwork Thu Oct 17 18:50:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 176686 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1340563ill; Thu, 17 Oct 2019 11:54:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxySGQwsAX1zTkIbK1H86PPxQdzMdSFCJEzMn4iiywjDl19VtEmQhnbUCGAfAJB0n96Six9 X-Received: by 2002:ac8:6956:: with SMTP id n22mr5388676qtr.7.1571338483576; Thu, 17 Oct 2019 11:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571338483; cv=none; d=google.com; s=arc-20160816; b=D6qNnv/rFsD/WnpaHwxxciplSeTS76AhBTNyhSWYSkyxgBkUW7VVnXkU5gxLAsakwR W1Z1BOStLBfqRFo+kmfARTqYfbvFURAHllAerlGE2ot+im3fKnYknNFKozRIUyUBRaym 1Lox5F+SwxMpprdVDeRYYyFbpkR0S1jHNhyY8XegzfKQfhrQrtR/z2BTsY8azHg96AeT 5hG2XCnqwhYvbC9q71hj8rxA99U5Uk+7h/ZD2SGqLVfb19zr8BEQpVxJRSfu9cmj771H s+I2AoDu2iNEppJVYcvMLqMa/xmbw+kzMRESx1+QBzYLmqTSu7jg3WzwyTp3ZIRbW+nW v/RQ== 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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=jCV6eHXSZvWXekgUe6BRp4zrVboBrYtpULAwtRbXpa4izXq8BBfjt1kEWUSY0NMLPr 4boqGQkzgvZCh0vsqxl+qK6IhUlebHgt+BOSPYn39JkEdeDJPBWmeBhrkSsKdktNL9Lo 5c01Yk7wR61+FR3TlQ2QBeBHkSjzenvx3F/VpAFw9rt4edP9LgfjVj9Utq5cg+gOdxVk qC6f3GNpBPe38Qu2uDUBoCny6bOKXX1fkUQ6U8uW2OTIrNRCoDIvaD/4UReNJkFKWW7x sAF+IYX2FpLJxtDrI/3z482IVS5/+jYpewcpBXBefon2n9N7RruYFh0+cb4Vc0SeFA8p y/7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=x3HJ+WlZ; 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 h65si2877105qkc.347.2019.10.17.11.54.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2019 11:54:43 -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=x3HJ+WlZ; 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]:56976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLAv4-0004tc-Is for patch@linaro.org; Thu, 17 Oct 2019 14:54:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35037) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLArm-00012b-NZ for qemu-devel@nongnu.org; Thu, 17 Oct 2019 14:51:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLArl-0000pv-NE for qemu-devel@nongnu.org; Thu, 17 Oct 2019 14:51:18 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:34849) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLArl-0000pX-Hr for qemu-devel@nongnu.org; Thu, 17 Oct 2019 14:51:17 -0400 Received: by mail-pg1-x544.google.com with SMTP id p30so1877127pgl.2 for ; Thu, 17 Oct 2019 11:51:17 -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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=x3HJ+WlZiIOQaJOpC7HfOW8NG5F/im4gZXFPtNgCl8FUUpjgkQI5cmvqa+AbjDLGrL gkg0h6VMkX60fMCBHiLvxaWP+VAUi2Mnnm3nYzhf1xtzaTchsZtmVHWPx5bjO2bPpi4k AGIxN1c/DX4MRsstodj/FN/TUuzIQLQ8o9pUTpHiQSEoDWrcEKpcsFWhT3qcbDS0SNDc AdomEEoshsoQ+a4zW+wQ0G1cJok5Jsj2tbjAVUzeFZTKsyWZnkBVt4ajs37Oha6ikM5o 5MEdKbYMB6DaxOp33i3q0YvINvZDwUt24X/sWOk1S2eQNgE3YoULikRmnjPpJnxLQRDg 0Qcw== 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=+UgAJ6EhcwGdb7pezBRTrZ79eaC+NjRs0dqrTWfzTFo=; b=obws+UIaRiqk6jIueK7sw1J1kAgr9jPECpuofLMxz3/9+qtdhIHmigUGKOzCQT7UqF zO0bvPBm+wdHmCgGfxsqg7nPVEbWREtKaPGDGUUPsZWREW+yPc70RqW/fr9huF41uTMv vDwbuPSVXUhYWA1XsFVV47zye5lZ3rUgTGTg6O9AlrQza9JmVOpwujSLPczJkLykQSRp GyLHtsBrNs+gPuir2ZTWHLsv2V+Wsyovw2GghSh+WTd28NP0BD5ZiMs5EdYlGU+fj7q1 RvBjsQcV2SxkquQvr7UF1t0iykbwnmW3F8mykdk6aM6pEV+i43kaKRo+6wX3f9d6omAq Y62g== X-Gm-Message-State: APjAAAUxGa8rwzt3tp9hFK7MARu9ZieukApP0fmbQHjNYAhdJZMzPLDA a6nt5Lklwx37Xrkv6xjNlQoJxQQH4yA= X-Received: by 2002:a62:ed01:: with SMTP id u1mr1865679pfh.54.1571338276212; Thu, 17 Oct 2019 11:51:16 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id s97sm5009256pjc.4.2019.10.17.11.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2019 11:51:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v7 03/20] target/arm: Split out rebuild_hflags_common_32 Date: Thu, 17 Oct 2019 11:50:53 -0700 Message-Id: <20191017185110.539-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191017185110.539-1-richard.henderson@linaro.org> References: <20191017185110.539-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 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: peter.maydell@linaro.org, qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create a function to compute the values of the TBFLAG_A32 bits that will be cached, and are used by all profiles. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/helper.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 69da04786e..f05d042474 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11070,6 +11070,15 @@ static uint32_t rebuild_hflags_common(CPUARMState *env, int fp_el, return flags; } +static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, + ARMMMUIdx mmu_idx, uint32_t flags) +{ + flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); + flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); + + return rebuild_hflags_common(env, fp_el, mmu_idx, flags); +} + static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, ARMMMUIdx mmu_idx) { @@ -11141,7 +11150,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, ARMMMUIdx mmu_idx = arm_mmu_idx(env); int current_el = arm_current_el(env); int fp_el = fp_exception_el(env, current_el); - uint32_t flags = 0; + uint32_t flags; if (is_a64(env)) { *pc = env->pc; @@ -11151,12 +11160,11 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } else { *pc = env->regs[15]; + flags = rebuild_hflags_common_32(env, fp_el, mmu_idx, 0); flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); flags = FIELD_DP32(flags, TBFLAG_A32, VECLEN, env->vfp.vec_len); flags = FIELD_DP32(flags, TBFLAG_A32, VECSTRIDE, env->vfp.vec_stride); flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits); - flags = FIELD_DP32(flags, TBFLAG_A32, SCTLR_B, arm_sctlr_b(env)); - flags = FIELD_DP32(flags, TBFLAG_A32, NS, !access_secure_reg(env)); if (env->vfp.xregs[ARM_VFP_FPEXC] & (1 << 30) || arm_el_is_aa64(env, 1) || arm_feature(env, ARM_FEATURE_M)) { flags = FIELD_DP32(flags, TBFLAG_A32, VFPEN, 1); @@ -11166,8 +11174,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags = FIELD_DP32(flags, TBFLAG_A32, XSCALE_CPAR, env->cp15.c15_cpar); } - - flags = rebuild_hflags_common(env, fp_el, mmu_idx, flags); } /* The SS_ACTIVE and PSTATE_SS bits correspond to the state machine