From patchwork Wed Oct 23 15:00:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 177315 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp897559ill; Wed, 23 Oct 2019 08:40:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQYI6Oq+mZqmRPRUoSMf4osbclmG/pWzHSVSsER4sJrzmoK5deUAReu5mHMvynGVcwLHa1 X-Received: by 2002:ac8:2484:: with SMTP id s4mr6281863qts.350.1571845213072; Wed, 23 Oct 2019 08:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571845213; cv=none; d=google.com; s=arc-20160816; b=wSaf86EpjtnJF4rjAxGVeFjuZOVc8/RsBYVPFBGW8kOMIiwnyig2ICEKvBs2Pki902 J6T5Vp1fuXinl6A1UOYCGn9J3qHKfIZBl97VykQpV6pDv9zKuyoOybbJw5jvYc4A6FLo KCkIat7m8vplrjqXku8ClYN9oB9XZkT2ccP3q87F6fIPx61Jtzt2sER03ASbz1ArAqMD i+IJaREG8RbCY0yOa56gsvIcn4ckgswGPURKFLCZk9vgZvRueXbFl1+V3v1gzos9QHK+ 6u/t1as3BuXPClFpUkSOXIKW2wfamb5ayhhcPd4xboSBW9XzBTIfs57cldflE5vQhS13 mGOA== 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=mDaUYtXyoxKyQ6YIW+CzLKUl72EI9Ve9jhEUulKMydM=; b=iS2uFp7P4WNfS6eipQnBszJg+s6tYFEn4Egvo5R0117gcUDl7Elxavt9SedGGfdgTM JzerZDFasuhCkimdjquXetyRJ2Wx+NiIy2EtRhL828OHn2iZb2cGNuCBZk14M5Puucnk yyKUQ3Tpn0svbHgQ8ayf5KI0asr70PaEEE86ApzzGYo7VpVX9vhupOA4XTgaKxgu7NQ7 QAFDhvf3gQvBMrBpGKebksq0abvKFPqUTORh/sG74vmgI/9h2OHKwIuwCP1Ngy9VC9+X K70AC99PFhrx0g9rsVFZbipqJneKIrpXLAebrypqDsHgRM3nJKSJ9luqmN+/HD9gyRNn uSfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gg4OUCU0; 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 u18si6406923qku.329.2019.10.23.08.40.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Oct 2019 08:40:13 -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=Gg4OUCU0; 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]:39684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNIk7-0007kr-Bm for patch@linaro.org; Wed, 23 Oct 2019 11:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35478) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNI8y-0008Gr-5j for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNI8r-0001GN-Ma for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:47 -0400 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]:34703) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iNI8r-000114-FR for qemu-devel@nongnu.org; Wed, 23 Oct 2019 11:01:41 -0400 Received: by mail-qt1-x843.google.com with SMTP id e14so12964116qto.1 for ; Wed, 23 Oct 2019 08:01:10 -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=mDaUYtXyoxKyQ6YIW+CzLKUl72EI9Ve9jhEUulKMydM=; b=Gg4OUCU0+YuFSqTxloUy7xv2L7XQ97PXUiiSXzc3OEJN69plKDFY10+lNGtEh/JgPh 2gmFn56lZzKeCyS4HAQycasM59zb1a6NxSRcubR8fqEHDm8F7sgbUtucEhIWaWQ1cREK mbgfkVLrGz6CW3a24YoMkuFJlYIBldjwFt9iuI8u5mPONaSl9QLHwN3H3dFwuaUqVrxL nXa2tlQ+h6wh9JrHlGX1dpnvCma4z4lsyr1vr1MpMaBssLlWX512qydTq0QD30cc5X+S qMnzKA+fnXAhu+OX4xs8gxUFzlzOhtevyK4NnhzOE71A2tK4DR9fm2nRQNZMKFja+tSw 3Jag== 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=mDaUYtXyoxKyQ6YIW+CzLKUl72EI9Ve9jhEUulKMydM=; b=gP21xiRv+OmRei96pqjO851HIKDb8TE0MOQ3+3WFqUeGUA7nz20BGyneCuMD98Oy8u XsDD/WzJijAOZmifLqTTlSBTWt1MQeMQtoS5EysaMe9vwubxo/IUWGyq3a/H8jvONh3P ZOSt3C/XRK10dfH2v59kI05r8iBkZmlz1SiZV8hARdY7KbiqOnz+29eKyZfFvw36AD9J EOGaVzoXuBII8/mleibOjHYGY2B57wzESbpqg9bil711/RA3yXDeJSqDv5MTMDQPigN/ me3jMQxCH+DaERMp6hpPkWr/IQFnCzxW8C3b0dvYWPZiTqxdw4o60vgvsN3o3slvoRN/ /zLA== X-Gm-Message-State: APjAAAX4cvKa6d6XZebpmVNPXdD9MlxbIUa07bKYCEAkTraoVq9zGHVD 04MZoHgvk/bsFZwKvz37R3iRULVvQqU= X-Received: by 2002:ad4:51cb:: with SMTP id p11mr5186448qvq.81.1571842869476; Wed, 23 Oct 2019 08:01:09 -0700 (PDT) Received: from localhost.localdomain (198-4-20-64.static.cosmoweb.net. [64.20.4.198]) by smtp.gmail.com with ESMTPSA id l189sm11030168qke.69.2019.10.23.08.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 08:01:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v9 05/24] target/arm: Split out rebuild_hflags_m32 Date: Wed, 23 Oct 2019 11:00:38 -0400 Message-Id: <20191023150057.25731-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191023150057.25731-1-richard.henderson@linaro.org> References: <20191023150057.25731-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::843 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 M-profile. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- target/arm/helper.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 4c65476d93..d4303420da 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11083,6 +11083,29 @@ static uint32_t rebuild_hflags_common_32(CPUARMState *env, int fp_el, return rebuild_hflags_common(env, fp_el, mmu_idx, flags); } +static uint32_t rebuild_hflags_m32(CPUARMState *env, int fp_el, + ARMMMUIdx mmu_idx) +{ + uint32_t flags = 0; + + if (arm_v7m_is_handler_mode(env)) { + flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); + } + + /* + * v8M always applies stack limit checks unless CCR.STKOFHFNMIGN + * is suppressing them because the requested execution priority + * is less than 0. + */ + if (arm_feature(env, ARM_FEATURE_V8) && + !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && + (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { + flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); + } + + return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); +} + static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, ARMMMUIdx mmu_idx) { @@ -11168,7 +11191,13 @@ 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); + + if (arm_feature(env, ARM_FEATURE_M)) { + flags = rebuild_hflags_m32(env, fp_el, mmu_idx); + } else { + 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); @@ -11204,20 +11233,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, } } - if (arm_v7m_is_handler_mode(env)) { - flags = FIELD_DP32(flags, TBFLAG_A32, HANDLER, 1); - } - - /* v8M always applies stack limit checks unless CCR.STKOFHFNMIGN is - * suppressing them because the requested execution priority is less than 0. - */ - if (arm_feature(env, ARM_FEATURE_V8) && - arm_feature(env, ARM_FEATURE_M) && - !((mmu_idx & ARM_MMU_IDX_M_NEGPRI) && - (env->v7m.ccr[env->v7m.secure] & R_V7M_CCR_STKOFHFNMIGN_MASK))) { - flags = FIELD_DP32(flags, TBFLAG_A32, STACKCHECK, 1); - } - if (arm_feature(env, ARM_FEATURE_M_SECURITY) && FIELD_EX32(env->v7m.fpccr[M_REG_S], V7M_FPCCR, S) != env->v7m.secure) { flags = FIELD_DP32(flags, TBFLAG_A32, FPCCR_S_WRONG, 1);