From patchwork Mon Feb 27 21:33:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 657127 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2584809wrb; Mon, 27 Feb 2023 13:36:55 -0800 (PST) X-Google-Smtp-Source: AK7set9oRj1bUYA6c+mW4e/RweS7w6fPr5LjkbppJVE4lgRnP/uKt9PQ7mpO791llZy1jeEzldVH X-Received: by 2002:ad4:5e8c:0:b0:56e:9a34:4eaf with SMTP id jl12-20020ad45e8c000000b0056e9a344eafmr1546779qvb.36.1677533815399; Mon, 27 Feb 2023 13:36:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677533815; cv=none; d=google.com; s=arc-20160816; b=e6BjS501Maiu3CkshAkMpf4qj7Ktud2vJVGi08pQZBwFc+qekLVxGak5X6cNwZSf5q U7PmfmHxXC/fvSW7MyS+m8QJS/ZNGgmobrMLWRDKxQc4FssoG2wpvdq+tvdNsGTtdQ8W mO5GSW4qZZdPhfDjtNeBT+hYTLLmLz/BJv+haj+YXlYp+sNtAzEMhloYbV6rBXO3ERMT hkJWPkiBGgYRqvsq+JBXDy2R3iz7K8soBd/g/Vs2FVc4f5ZeADyTL2018VNzbFxu6Gs6 qXE3+wdwrrEEzeO3uaXM5+qx0tRwvEFMr55W+tiLp2ufF1FqP9N6PI/1xZ7WoWhiClkW Bd6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=oFabQEE82JV36HMrVDQBYDbr2a18gGcUEuaUfpMg43Q=; b=Fusb0WL0Bccln6hPoW7OWcsIq4J9B1N13eSCzi2P9MV4fgJOyDydIl9p8N2lId6pFL I9jBudPlTp1syRoBKrEBDeNKxjA415CqiK74hOxOCb7gK5QnJen3VdbMkN3MYpagvx3R jDtxaYukT0IWa61o0yiUBSv11HmSWmUqlNK81QxRx807xukwY/TEwS71c3Xgu3TgmDji IIp62OVBl+LSp08T2+9iCSHAgemBxImHeyvGGd1Tv/FAqYdAeC5fvWMfcYjYcr1tg6ld qMfu7hrE9lSs3EywqIAZpDAdv4lNFIcNoN0kCMgfIenLy/CkhaZ/Jqnbp0cI6vnhymG2 hxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mxv/KyZ/"; 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 r1-20020a0ccc01000000b0056ea051a8edsi7163753qvk.323.2023.02.27.13.36.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 13:36:55 -0800 (PST) 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="mxv/KyZ/"; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWl86-0007Mx-JS; Mon, 27 Feb 2023 16:33:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWl85-0007Ik-KY for qemu-devel@nongnu.org; Mon, 27 Feb 2023 16:33:53 -0500 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWl83-0004Kt-Ra for qemu-devel@nongnu.org; Mon, 27 Feb 2023 16:33:53 -0500 Received: by mail-pl1-x62f.google.com with SMTP id i3so8265429plg.6 for ; Mon, 27 Feb 2023 13:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oFabQEE82JV36HMrVDQBYDbr2a18gGcUEuaUfpMg43Q=; b=mxv/KyZ/rhHd4cQavQuKiVpgjunHydFwPctfMhrwvdpDVu0s2JQx8ueIawA8daj/B4 +KTRZru9muo0r478dJ+rEcTp2kCRIbZRuosVr7S7mLUHjJxU8vD6uQPuBBBs3hyQTZ3u tJXEsp8Z33IlnDTjFB9EJbp3KEbBrCXsXtfI3iqgQd2EQTYjubBVAPRHHt4KVCFZLLQF McLIpV74yI00QpxhRmYedjMeXrxHR3keT8jpj3p6HloPrkhQ43Qg8gK+Ck7XtMNy+wHC 6YAsyM+6yadS9zRReYbTYjBARE8wsHhsN1Z9TjD0BxTWLsEUnAIeUCeb0F51hI59dTiV Hg5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oFabQEE82JV36HMrVDQBYDbr2a18gGcUEuaUfpMg43Q=; b=UYD4qL0RV8biD+yDQy/8VM/SSlxE2046hxQtoS+iq74qdRUmA4Oa8r17tzx2QMqhUM XlMz1+AztFV3r2VOtKM0s9k9SJrHrWWX4+uQnrHAN80xBf+g4SMx8tQfXAMGrFIlcbIf v69IL/FkQAcM0/bTzrr88XoUkTCz97c2aHDNWluHoCGkdSZqFsXz6K2+6dh6NsRdi0Ao TfOjyZ8S6H/wHMCtvhW5KE90sjIw3orVsrJzVEpZRfO1BrCN8YHa2ZcCHKReMUznCODr gzYBpbqOQ+IC3HwSvIXFRq4q4FE4VtZ3fXPetMjKe7UTyLJOIV/9oqg7USDrejacyJ0D A/Hw== X-Gm-Message-State: AO0yUKVuHew2obbJb1ruoqgYyd89pWyk1qsv3m6+gIf5NuNkBPpW4Qnn mRW3erEMEwsrhGmrZWyGhv1LaWbVJ02vjoAYGQM= X-Received: by 2002:a17:90b:4b52:b0:237:3d0c:89ae with SMTP id mi18-20020a17090b4b5200b002373d0c89aemr604646pjb.34.1677533630523; Mon, 27 Feb 2023 13:33:50 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id d137-20020a63368f000000b00478c48cf73csm4375262pga.82.2023.02.27.13.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 13:33:50 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, David Reiss , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v3 12/14] target/arm: Export arm_v7m_mrs_control Date: Mon, 27 Feb 2023 11:33:27 -1000 Message-Id: <20230227213329.793795-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230227213329.793795-1-richard.henderson@linaro.org> References: <20230227213329.793795-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: David Reiss Allow the function to be used outside of m_helper.c. Rename with an "arm_" prefix. Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: David Reiss [rth: Split out of a larger patch] Signed-off-by: Richard Henderson --- target/arm/internals.h | 3 +++ target/arm/tcg/m_helper.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index 97271117a4..0f2c48ad4b 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1355,6 +1355,9 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp); void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp); #endif +/* Read the CONTROL register as the MRS instruction would. */ +uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure); + #ifdef CONFIG_USER_ONLY static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { } #else diff --git a/target/arm/tcg/m_helper.c b/target/arm/tcg/m_helper.c index f94e87e728..03be79e7bf 100644 --- a/target/arm/tcg/m_helper.c +++ b/target/arm/tcg/m_helper.c @@ -56,7 +56,7 @@ static uint32_t v7m_mrs_xpsr(CPUARMState *env, uint32_t reg, unsigned el) return xpsr_read(env) & mask; } -static uint32_t v7m_mrs_control(CPUARMState *env, uint32_t secure) +uint32_t arm_v7m_mrs_control(CPUARMState *env, uint32_t secure) { uint32_t value = env->v7m.control[secure]; @@ -93,7 +93,7 @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) case 0 ... 7: /* xPSR sub-fields */ return v7m_mrs_xpsr(env, reg, 0); case 20: /* CONTROL */ - return v7m_mrs_control(env, 0); + return arm_v7m_mrs_control(env, 0); default: /* Unprivileged reads others as zero. */ return 0; @@ -2465,7 +2465,7 @@ uint32_t HELPER(v7m_mrs)(CPUARMState *env, uint32_t reg) case 0 ... 7: /* xPSR sub-fields */ return v7m_mrs_xpsr(env, reg, el); case 20: /* CONTROL */ - return v7m_mrs_control(env, env->v7m.secure); + return arm_v7m_mrs_control(env, env->v7m.secure); case 0x94: /* CONTROL_NS */ /* * We have to handle this here because unprivileged Secure code