From patchwork Fri Oct 11 15:55:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 175990 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp950431ill; Fri, 11 Oct 2019 09:04:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5iAszBvxAy1J2s3BblRrvX8Wwgo2v7MJswmyyZaGxyZUzIdr9gMVamTE8G6QO7GNqYYIj X-Received: by 2002:aa7:c6cf:: with SMTP id b15mr14199670eds.215.1570809862084; Fri, 11 Oct 2019 09:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570809862; cv=none; d=google.com; s=arc-20160816; b=yVWGvEK1xQH54uSxSWwO5xjYVtDcgGacD8KAFkBHribB9Qs9UGEtkwcuptTi1UjVFg RsknVJZ+HK7FLcvmIVLXi5N0qnPnseTkM5/n/EbhJ6u4X4Tnhfs/pRKRyhfSAN9fR81Z Oe+H1dqvxwy4vXcXY04Ce4cJOqNh5agWTJKnn0u8FwIwCL4lgtLKlNyslopkJI22Fm8g pcBUlyi35z7yzwaTtVYwCaZCdwN8RhScGWGzmyd4sX8eUq3lkqdCH3hQh2zWjTG0YWod 7akpvwyNOcOhn6FL/H9RpZhDYNcX6z+oyX8P7R8EiXgjFsQJcB4rIgQ9tPHrRIrsemgd Owbw== 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:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=20mv2SwJCcd4Z6z1yWs3I8qxDMrWegtCA17Quz1+Bvk=; b=sNFYk2HfaWZdi71KwvgS8quMziGkA6fHnj+yCF/Eq2hwf7ZcjkcyYSWi5XB6vLG1C5 3A8c1g8zMg5lRPmnjTiwKFELOLJSiRTOtbkpbESctHibtGy6Y1MhqoskC84UvtkqcfgE tlR19z10Fe4RFMTX5xu1AWWQw3DgidwNbFC9/msVhaFw8U6Qw2MQ7mQpkMeoMuqFFx+5 sFWOndM0GGGzvEU2yhOu2CmYT5p1Ma2wV3UZTGI1u5ObK26DvoxQ6Yym16A83Zq5kPhS SwoYyZT0ef1SaDCrdXlpRP8LgnOvSi06/A4c6ibqKTszRvvFDizk4uCwpnrynMJmxo6s xscg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=wI1VxkTS; 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 k15si4242854ejs.401.2019.10.11.09.04.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Oct 2019 09:04:22 -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=wI1VxkTS; 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]:52940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIxOu-0002LF-BB for patch@linaro.org; Fri, 11 Oct 2019 12:04:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33644) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iIxGn-0002Jp-7l for qemu-devel@nongnu.org; Fri, 11 Oct 2019 11:55:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iIxGm-0007dN-1k for qemu-devel@nongnu.org; Fri, 11 Oct 2019 11:55:57 -0400 Received: from mail-yw1-xc44.google.com ([2607:f8b0:4864:20::c44]:37996) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iIxGl-0007bC-UK for qemu-devel@nongnu.org; Fri, 11 Oct 2019 11:55:55 -0400 Received: by mail-yw1-xc44.google.com with SMTP id s6so3647643ywe.5 for ; Fri, 11 Oct 2019 08:55:55 -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=20mv2SwJCcd4Z6z1yWs3I8qxDMrWegtCA17Quz1+Bvk=; b=wI1VxkTSfsDPcY0D4LXTbNeyeaDOil9aLBZPJBvtGAdOpRZIUQsthATLdyZwSU9yUV OvjTl2IAwX056fnXwm3bcjUJ0YER/p9KXYRvJoKWJ6qvt8sA3Q/OD9HWvG3cgCSjfaeJ 4MWfAhzOnRmt9s23xi6k0MJKMbc/z4mgCXbq7jjg7vWPrXtiB75bsVmaxQ4YgiLCu8Wm 8Y3sjHBT9yr4AQSrNoB5wzU/LrYUfxhHrw6nyD9pNmH7j/iKotOIC0H1CjnC9deUyDyH YbsKV8gLDYnPE18HyREFW9+BLw1MMaPrqYKSmbe0N4m7V93QJrR83HeTgLwCzksI/AOa ZFFg== 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=20mv2SwJCcd4Z6z1yWs3I8qxDMrWegtCA17Quz1+Bvk=; b=k46nzDUsZgOZ++Z6cC5cz775y/Y46VKP9hpwUw0JDeH4DY5Kd/Aes/v9pTmGQOez/E ZYpZrE4XwYzQGkOYy7W6V+FcHnI6Dx/B3J7PQOeK7+N/1/L65E/Lf0MYYYWguRMdPvUI jmGVbs17RsTzh8zcWRqQ65qIHFV7jXtEDevWNNu7GjEa8ZosByhRVfQdFJHjxHWnYyWk csfwx8RYOVaVnnTT/5Z3I19taUGIMhGfluHNf1VBMeink3PqbjAWhdCYGj7SFw54gDFT RC2VDl7HVXwsoh7iiOeBiTsk3csNhvYMfBQ6z86RTcf9hZ77lvu7+8tDW/wCAfOjNEPs RuWw== X-Gm-Message-State: APjAAAX7jP4itvWBC/9rqKV3pW8Z1kUVWxPw+nJIl64bE/Z2AvLbJVft HV5zs4kqEpkglXYpTiXw/peBIYinuqE= X-Received: by 2002:a81:368a:: with SMTP id d132mr2805565ywa.390.1570809353810; Fri, 11 Oct 2019 08:55:53 -0700 (PDT) Received: from cloudburst.gateway.pace.com (67.216.151.25.pool.hargray.net. [67.216.151.25]) by smtp.gmail.com with ESMTPSA id d17sm2473139ywb.95.2019.10.11.08.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2019 08:55:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v6 05/20] target/arm: Split out rebuild_hflags_m32 Date: Fri, 11 Oct 2019 11:55:31 -0400 Message-Id: <20191011155546.14342-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191011155546.14342-1-richard.henderson@linaro.org> References: <20191011155546.14342-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::c44 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: laurent.desnogues@gmail.com, 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. Signed-off-by: Richard Henderson --- target/arm/helper.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) -- 2.17.1 Reviewed-by: Alex Bennée 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);