From patchwork Thu Aug 9 04:21:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 143660 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1605633ljj; Wed, 8 Aug 2018 21:27:55 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxnjbocynL3ZBnWlae186/yycDS3X8Dv/NI4VYExdmk2pnqRCttcm7FMhki5fOLbvanBAmF X-Received: by 2002:a0c:891a:: with SMTP id 26-v6mr410274qvp.195.1533788875424; Wed, 08 Aug 2018 21:27:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533788875; cv=none; d=google.com; s=arc-20160816; b=kICgj3F1CbVCNp3Wwf/OW40Ok/EhZZ8OMkSKzjZCkxWG8/usPMxQQfgZ2QJSBdepDv cqu++KkbeVHtQfEIZEu3GKf55cCPU96CAUqUAJnDpP4YCgyoloHmlPj8ZtvzhwIrll8V Mc/NT1DeLLlEXE8jhYPsYbDQclayEM1T9T3CBTzwyGc455oNf6PA4ysCguYWzbQtep8W YP4v+m9Prd9EKtv3QtDWoTvH1ziUIGHmNbCIRWU/L7FDlO9zxmLyGL9n7h+PSdYMrp77 7Ds5APQlDN1H6SvotRFxZO0l4Ta+s3Kp0pmboHpjGilP+SekHzEn+o5aN9UMpZD3SE+O qjRA== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=sg+bJaDUMi6cidJwpuhz8YqPDcihHRJslrVPGNZ4Mos=; b=hAKFFp11B3ieGuBBPl30mLfcERm5QecjN8ma2qCJ33IZSVV+yLP6R3fFInyKphjnbp /wZG7dQZ0Si1J9n11BuDnn9SSD4uVnUWQi+ZUJhiAzabgUNDPl1pgqbcOwAjX/Wn95Z2 EgnURGLtHu0B4AyXT1BptpaAWsOyfViBZ7Oxzo3if0o9nB6WmLoS+noPpFraaVqdG4k5 ngGpbfMdtDwKMIV1VGvjSsgKYEet/JIXZarq9uokEtxXlle+h+XPCOlAZ7r31g23ZDgF pXitP/8NXwUw+W4w1dFFa4koThnLhiM9pneSazmvqj1NhWDQDtVF3Yd813u7Hx+TLfSv UOCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Mcda91sy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s63-v6si3963381qkc.404.2018.08.08.21.27.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Aug 2018 21:27:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Mcda91sy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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]:47247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fncYE-0004ic-NG for patch@linaro.org; Thu, 09 Aug 2018 00:27:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fncSn-0000jl-Nz for qemu-devel@nongnu.org; Thu, 09 Aug 2018 00:22:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fncSm-0007BU-S5 for qemu-devel@nongnu.org; Thu, 09 Aug 2018 00:22:17 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:44430) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fncSm-0007AK-ML for qemu-devel@nongnu.org; Thu, 09 Aug 2018 00:22:16 -0400 Received: by mail-pf1-x431.google.com with SMTP id k21-v6so2183463pff.11 for ; Wed, 08 Aug 2018 21:22:16 -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; bh=sg+bJaDUMi6cidJwpuhz8YqPDcihHRJslrVPGNZ4Mos=; b=Mcda91syyAH9u8d5quYw0bmttmt+OV2kvugDfqhywYgYFHt4pehwttOTFov106bZ8e CkZtCUCVBf/NPw4foPr+pKGtUnw9x9FTp1+mvL8XHLJU9n6m8Jo4eKlFjcHguVl30xMk yKt/DWhmLNRhoL5LNtxF5z8RIG116wjewYPbc= 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=sg+bJaDUMi6cidJwpuhz8YqPDcihHRJslrVPGNZ4Mos=; b=bAZZef/QOoYZkmTIwQidYAb65ebM1pUxETJK4rEGSuuK9HZpLY98BZcVIlLx00H2wk ufnv/0aOsZ4IuBFzL39z0Hqydxqy7vsvep71Hx6PlBcb2wOl8U41AIfl7dNey5hF5mNG /4EJXhUsuP80ukNpH1DltuWrX6dr+oYPu6gPMle92AEcs+54wnifJy+UcPQl0w9BUVHc 8QF302bkjxKXosPxBhjS6C8kLM0GrCs9cX1uHJCzEJjq6DqK/qM4TMrtqhIIWII95YEZ r8hO9U2taPhLKgF0RbmEWYlahR1HiXErTQ4BjXCt/g6QGEBrc8R/LgllVSzegOYQG2ap dPfw== X-Gm-Message-State: AOUpUlFkILF+vfm+B+WOcZ50QLZuMoRIc+eJNon1bhL3LJnGAf+1BQ0L 5d3O2/6nAPAKRF/lO6XSaTD8vtSWS3M= X-Received: by 2002:a62:4b48:: with SMTP id y69-v6mr558409pfa.93.1533788535421; Wed, 08 Aug 2018 21:22:15 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id m30-v6sm7355799pff.121.2018.08.08.21.22.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 21:22:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 21:21:51 -0700 Message-Id: <20180809042206.15726-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809042206.15726-1-richard.henderson@linaro.org> References: <20180809042206.15726-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::431 Subject: [Qemu-devel] [PATCH 05/20] target/arm: Fix arm_cpu_data_is_big_endian for aa64 user-only 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: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Unlike aa32, endianness cannot be adjusted by userland in aa64. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 9526ed27cb..2d6d7d03aa 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2709,8 +2709,6 @@ static inline bool arm_sctlr_b(CPUARMState *env) /* 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 @@ -2729,15 +2727,24 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) arm_sctlr_b(env) || #endif ((env->uncached_cpsr & CPSR_E) ? 1 : 0); + } else { +#ifdef CONFIG_USER_ONLY + /* AArch64 does not have a SETEND instruction; endianness + * for usermode is fixed at compile-time. + */ +# ifdef TARGET_WORDS_BIGENDIAN + return true; +# else + return false; +# endif +#else + int cur_el = arm_current_el(env); + if (cur_el == 0) { + return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0; + } + return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0; +#endif } - - cur_el = arm_current_el(env); - - if (cur_el == 0) { - return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0; - } - - return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0; } #include "exec/cpu-all.h"