From patchwork Tue Aug 20 21:07:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 171845 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp75227ily; Tue, 20 Aug 2019 14:12:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzax04QgCl1bPw+aNod2GFZaIjVvYZRBAkKoRnqrbcBdsB80BEGtiPSKUfMcnBFpOBx4uO X-Received: by 2002:ac8:4247:: with SMTP id r7mr28371388qtm.219.1566335561504; Tue, 20 Aug 2019 14:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566335561; cv=none; d=google.com; s=arc-20160816; b=mH553MkI8LNgcgHcHX4nCbxlR/gRxoTcSV+U894/0me5t6QiJ9f5/ENFN4dvkK/Iq7 aBXaDLgit2OOTQJdHN7RANfyPbThvitnE6xElsvSVfnnUTDBviW467b4BwboepV1LWGt Yl8ewUAlWZHd80Wet55nKN6vYDUC3MKFobKlofCXQRzDZYtod0/bEc08vg0iVhbOcpGN Avh30ZTtixAaPNZlw6GDlMsYvsSqzlD+RfAGDolRqP+WZK2gxxl9N751PHWHAXrSb2qc YEhidHyr2POp0raKuOi36OvdTaLj0GYgzH+iPhzeb3/hbPLdPQUZU0pW7eKvYy9x7u0q kYfQ== 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; bh=q1Zy0h8c3J4D30AFqGiFYUkCGaChDdqpfUNuVmWLPgM=; b=PkC3wiGayFLVFuzP1hMCPTWGwnwOyrHYS28eqsXzGqy9UtDIunm0+HZRX6fWSM07Su hxjVykw6R9Om6qCh4Cc7tS+42trWyNe9kx9DVjMe+J4gQQugyuSYgS2J+JcpZso8lTjh DKgkUrY73TjyDE5G5JN3vFXhwpjkyAMauDNx0W+eXdaqoCuYc/Bwv27q1KiTRx+Kw0vO 1OuDcTM6pjbmcj068yjnMz8vG1XIVFB3BpH1H5neItuEPZ5Yf8ySKlqGlz/IENKYIrNo 7SCyTe46G2xsPGQpomaUAcDBpG+tj3GgP/vSDnfqD8wAueh69X6yfYDiKGbGOzfLr57X uakQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=jN7XTRkf; 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 n36si11776182qtf.171.2019.08.20.14.12.41 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Aug 2019 14:12:41 -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=jN7XTRkf; 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]:41743 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0BQl-0004xc-R0 for patch@linaro.org; Tue, 20 Aug 2019 17:12:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53757) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0BLs-0000Gu-U6 for qemu-devel@nongnu.org; Tue, 20 Aug 2019 17:07:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0BLo-0008Qn-9V for qemu-devel@nongnu.org; Tue, 20 Aug 2019 17:07:33 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:42817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i0BLn-0008PO-Le for qemu-devel@nongnu.org; Tue, 20 Aug 2019 17:07:32 -0400 Received: by mail-pg1-x543.google.com with SMTP id p3so5139pgb.9 for ; Tue, 20 Aug 2019 14:07:30 -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=q1Zy0h8c3J4D30AFqGiFYUkCGaChDdqpfUNuVmWLPgM=; b=jN7XTRkfRBVPUpHW/tfohU5SfFaGZUq6eh1Dz11xAiHA3EZLmzD3JG1tVdp9kNpY4s 7iYxabCwzS5xw2bAdWowKbwPiCcCjGK83zfTzBkP3g1rBQm2DW32ZJUm7eH0kb9a55+H HBglPPUKviN8JBvv2O/Nh2hE5/GLSIO26zocAdsm1YeSiQ1K0xODeodUpjVL0dfW+YtO Zv9+XZsBa2KWnZASn1BMq7G8ooDAvpMqRWMdTNStrvTWkxKh+2YglH1dioxBfLscYCgF E1w2+lG2Jdbh8l5rj8NLX9/SdXaGTKp9okMsfyp6UVoRAXZZeqRhIEf2RloiEkI0bS24 n5lw== 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=q1Zy0h8c3J4D30AFqGiFYUkCGaChDdqpfUNuVmWLPgM=; b=UMECAMIYujVfePngteoTfSby5embpuqQ/gw+mnOSs5wYs9CBlc6zf44tDPAy0PJOnF gOStEujpZcp+4CvTxQnbGjL4SYYKg+DLKVmg1sNdcwc/kU/+tSfeOc05wbz5t0fr23Yf HiQw233Rtr50XsfAUhKZsHukTWLY352HdjLdENt2lGq0x0buG9Qw9+ofap0Gx9yKoaph uTUBLb4hk86z2GxOBeHPA15mHgTCgqifIwtuUJ8E2dlr8O497ygJ2nMc0qDYusjxWATv 9S1ZMs1+TxVIqBrH2wjXfdEw02fbsfOEO4U8EvVgCp4yTAaDNxGB66Ub+tCPZuRKkdrz N1KQ== X-Gm-Message-State: APjAAAXjGw96SjcnSmzUSLrxWzlR5k4Jco+yEdqeMLrfdz9L+3jkIgEQ RkP5Kxje2ILvC7DG7rfoumBhmg15ZP0= X-Received: by 2002:a63:d84e:: with SMTP id k14mr26449715pgj.234.1566335249619; Tue, 20 Aug 2019 14:07:29 -0700 (PDT) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id k22sm21690743pfk.157.2019.08.20.14.07.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2019 14:07:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 20 Aug 2019 14:07:08 -0700 Message-Id: <20190820210720.18976-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190820210720.18976-1-richard.henderson@linaro.org> References: <20190820210720.18976-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::543 Subject: [Qemu-devel] [PATCH v5 05/17] target/arm: Split out rebuild_hflags_m32 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. 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 6570d7e195..c36ec6c530 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11045,6 +11045,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) { @@ -11130,7 +11153,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); @@ -11166,20 +11195,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);