From nobody Sun Nov 9 16:03:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551320944443107.21698101554762; Wed, 27 Feb 2019 18:29:04 -0800 (PST) Received: from localhost ([127.0.0.1]:55900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzBRT-0006XY-SY for importer@patchew.org; Wed, 27 Feb 2019 21:28:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzBN9-0003OJ-Ha for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzBMz-00053N-4W for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:21 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:40170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzBMy-000522-Sp for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:21 -0500 Received: by mail-pf1-x444.google.com with SMTP id h1so8937762pfo.7 for ; Wed, 27 Feb 2019 18:24:20 -0800 (PST) Received: from cloudburst.dc.rr.com ([2605:e000:100e:478c:cfa2:eb27:db4f:e85]) by smtp.gmail.com with ESMTPSA id l28sm11928346pfi.186.2019.02.27.18.24.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Feb 2019 18:24:18 -0800 (PST) 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; bh=xvID2qgXqZj1yGEiZojx46MlPX9UnBo71CxlwZmoZ40=; b=xCTNdYeWRjgqo7ok6xeWY3ZVoD9buli3q+Ooz/Cwtx9k6CN//5r1sAOlS2eIU/QZz/ T31zAw7ms9Rr77j9oqqp/wqAk9KAXK8Q9pH3aOwRG8InA83aDoDCKuv0ZQDQSSrA3bKV CwEC5bvk6HOD3wcKklL6Q4LR6ziv5GViDizGlmEe/rZpVug4W+piK0Lj6NM+A1jzP7hu rPVomHrKPUL0GNpoCtQ2892s5WQ2sOGhF4IyAgNsdKW2Pm2Psgj6/QHnwLuzINZzlFW1 t+Y3ILRo6VsRjwGohiBoMVltJAnnpTk3v2jwfFgf1M0y8EbI7Q6Cqd45f+THDBAqn1ZP TISQ== 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=xvID2qgXqZj1yGEiZojx46MlPX9UnBo71CxlwZmoZ40=; b=jfbRxpnhkhkyAWHvRpo5x6ywh+c9BydAs2RCdcJak1AxnbkzbYinIpuvfjiwCB7uXj Puam8bR1aK0qPoDnnLYEvKFd88XMi4GwDKf6PIrIHr5CnLK4kRtYnA8Z5HT06H2uItuw Ma856dB4ee1IFRIsQ5IchneZ8BsQPJJyexE0RnK9M4AdNtcmnGQ71FXDVLd6szMJ2aKT 14JfRLfT9cQVI6v1vyI0PBiWWcB35LomgUb4Ind4k4s7Ec2movnMzMvnxGRHVS1Xoywp 1KUEsZj9Zc4u0ggxlD6OHFb7xQ9mHMMspNcIbtIm3NFq+tG3fANTuwpnW5mQE06VHoZ6 IxbA== X-Gm-Message-State: AHQUAuZF6MNJfFzcIpbT5e0xuOZk77i6zTpkdx7DRv6CEteJAYVwcUCU vs9BG2suZ7T6NijxDTCXjRVU58Xx6q0= X-Google-Smtp-Source: AHgI3IYm2MAQLQ/KjvF/D41Hb6kBRDP0s+NvW2M5YSnoqtv8vQU25JNbRuJbXiJIyKyT/x2+b98JkQ== X-Received: by 2002:a63:455f:: with SMTP id u31mr6053273pgk.241.1551320659482; Wed, 27 Feb 2019 18:24:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 27 Feb 2019 18:24:13 -0800 Message-Id: <20190228022415.27878-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190228022415.27878-1-richard.henderson@linaro.org> References: <20190228022415.27878-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v2 1/3] target/arm: Split out arm_sctlr 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Minimize the number of places that will need updating when the virtual host extensions are added. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 26 ++++++++++++++++---------- target/arm/helper.c | 8 ++------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 1eea1a408b..9a4c56826a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3029,11 +3029,20 @@ static inline bool arm_sctlr_b(CPUARMState *env) (env->cp15.sctlr_el[1] & SCTLR_B) !=3D 0; } =20 +static inline uint64_t arm_sctlr(CPUARMState *env, int el) +{ + if (el =3D=3D 0) { + /* FIXME: ARMv8.1-VHE S2 translation regime. */ + return env->cp15.sctlr_el[1]; + } else { + return env->cp15.sctlr_el[el]; + } +} + + /* Return true if the processor is in big-endian mode. */ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) { - int cur_el; - /* In 32bit endianness is determined by looking at CPSR's E bit */ if (!is_a64(env)) { return @@ -3052,15 +3061,12 @@ static inline bool arm_cpu_data_is_big_endian(CPUAR= MState *env) arm_sctlr_b(env) || #endif ((env->uncached_cpsr & CPSR_E) ? 1 : 0); + } else { + int cur_el =3D arm_current_el(env); + uint64_t sctlr =3D arm_sctlr(env, cur_el); + + return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) !=3D 0; } - - cur_el =3D arm_current_el(env); - - if (cur_el =3D=3D 0) { - return (env->cp15.sctlr_el[1] & SCTLR_E0E) !=3D 0; - } - - return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) !=3D 0; } =20 #include "exec/cpu-all.h" diff --git a/target/arm/helper.c b/target/arm/helper.c index fbaa801cea..8a71a80dfd 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12877,12 +12877,8 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target= _ulong *pc, flags =3D FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); } =20 - if (current_el =3D=3D 0) { - /* FIXME: ARMv8.1-VHE S2 translation regime. */ - sctlr =3D env->cp15.sctlr_el[1]; - } else { - sctlr =3D env->cp15.sctlr_el[current_el]; - } + sctlr =3D arm_sctlr(env, current_el); + if (cpu_isar_feature(aa64_pauth, cpu)) { /* * In order to save space in flags, we record only whether --=20 2.17.2