From patchwork Mon May 23 20:47:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 575413 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:c603:0:0:0:0 with SMTP id jv3csp1737062mab; Mon, 23 May 2022 14:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhXHSlQ9ibR+PN33dJaJhMq20NAClRIjsxy7LMKm0lRWuel45ZwcVnBe4HYLXLqnSxzhZI X-Received: by 2002:ac8:58c3:0:b0:2f9:2356:d21f with SMTP id u3-20020ac858c3000000b002f92356d21fmr10981215qta.265.1653339967415; Mon, 23 May 2022 14:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653339967; cv=none; d=google.com; s=arc-20160816; b=yLTl7Vz72W+x2s59gAZMmrQswqxZ+8zMOd7d++OroMUJXw9Tgh6LVRQCwVslVLnCl0 Lm/IQx8+Xfvj8rFHxkVz2ZGYpzvYHSpuJL2HaWYPpgDaHYE6aJhgh5xanQTVD+XTdH8K EMRh1LIL1rpWfUSUANSPQKMq0HlC45fBN2nXNq034ErUIWJSKDMPhXJXJwGQbyiKPp/+ fjCGOW927VBrjyF6UsZ0/7F3Qj4fEsOcgDzZH/E1SZVzhBCRq/JjoxCyU6tBFfmdYFpt DvK/kCEoOBgGsRaMmfSIZg0lMFujAl9nxYLfQIU2dTzj27WmgzQ8SHDqCqLWPNtzWjcT /pNQ== 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=Ob+JyjaA3mDDf+b8simoocWpP1x20nWcpANbzQ0uZBM=; b=k84h27z5hM4Gqpcy2DO70V26yEHIEtCUUqOFUydQ9IpglXTafyQSG+gWx8PEc+tNQC w1VHdiX5g78eCQ4fF3pkT6oXtYfwB8CPCplLyvYV8SIJGgkrTKOMX6ZviGC4Y7S5Z9HL ouzbT77R3UkpHbGLdK2+TBK6JPPb4prTlaYXt5ewii7gswV1svINN10Uyw9juiBgEQQ5 nHd7kWMwBTH41oXhXFG/x2D4zPrvZTCF8QgYUOQK/ItN4xXKuIMamqlniArLe83vb1OI Xsa0FYyGSeG91otH2qL5eL45zsnFivZRYeCZGfy+GHbQiTKjnApuzJrMOyw4np/Ng6bh vsHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VnGdZIAf; 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 u8-20020a05622a010800b002f1ffe79437si3147783qtw.82.2022.05.23.14.06.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 May 2022 14:06:07 -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=VnGdZIAf; 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]:57456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ntFFe-0003xm-NL for patch@linaro.org; Mon, 23 May 2022 17:06:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ntEyI-0000Tb-Os for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:10 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:42932) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ntEyA-000539-D0 for qemu-devel@nongnu.org; Mon, 23 May 2022 16:48:10 -0400 Received: by mail-pj1-x1032.google.com with SMTP id a23-20020a17090acb9700b001df4e9f4870so368820pju.1 for ; Mon, 23 May 2022 13:48:01 -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=Ob+JyjaA3mDDf+b8simoocWpP1x20nWcpANbzQ0uZBM=; b=VnGdZIAfsxGX2A4Styl41yxY6YhZFwHIPel9299tBkUrkLEJiN68NpTefiUc84oPBp Dvi7YAVa4afGw44WCtsyBAPi/R1AxIKMOIzlmZHuPAZFkIe21ZQQgumLaJ7OnCLXZNcg nmdRErpC6cdNXm/Nz7Il7MtklrC4SxUKl/bqh2IOwnsnjEGyKpCzXQ3QIHbImOQIpgiC 0mge07PpBSkekU9y8LHEFIENHBgIGSvnQrw+/wdiTH8S7JkJKm921MRvcp1E26Z+Ctde 6W1uFLE1q19ZNHmuU4v1nm8YW6Lz/f8j40tg8J5zhRGjLQPwdqXZgzumWGHf/eqHLuwQ WJ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ob+JyjaA3mDDf+b8simoocWpP1x20nWcpANbzQ0uZBM=; b=LeWY3MUd6letBShLFk5WMQ8U5/TkVjEKYOZlrET5V7G0rR/67WuZgH4ofyetDwH6O1 I9tuWxWrtN34YGkZrBiNLwrksnxBttTeBV/YBpdmvcHvrPwI4EhOqYVuaFFjae2dMvDn 2G1+q3NpzYSy6Qkmq8b4Mt4tI/x9qYoKv5iGaVzTdsMPP+n20NRsnda3CV6pkYC7NkrF sOkLGHYmJTOaMtHDRqBU6vQ/lxZV7QhfOJAKEedVaXKvZgiNidkHN6xkivP9Xy3nzS/l daIWOffIJu4obzlBjpU+LKs8P/jvlPA0gxsKt/8dxOhjNM0PdwkRw7bocQaN5pGxhUwy 7eDg== X-Gm-Message-State: AOAM5310GEpubNJk9rgFWCjFnbLSAvt0OcI4mK+pTZP+2rQecaxenOmV q00GUQouokk1L0CDjz8nsFRpMHxX86Qr5g== X-Received: by 2002:a17:902:e80c:b0:161:9b73:3908 with SMTP id u12-20020a170902e80c00b001619b733908mr24367791plg.54.1653338881549; Mon, 23 May 2022 13:48:01 -0700 (PDT) Received: from stoup.. ([71.212.142.129]) by smtp.gmail.com with ESMTPSA id c16-20020a624e10000000b0050dc7628142sm7721788pfb.28.2022.05.23.13.48.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 13:48:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 17/18] target/arm: Add cur_el parameter to arm_generate_debug_exceptions Date: Mon, 23 May 2022 13:47:41 -0700 Message-Id: <20220523204742.740932-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220523204742.740932-1-richard.henderson@linaro.org> References: <20220523204742.740932-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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" We often have this value already handy in the caller. Signed-off-by: Richard Henderson --- target/arm/internals.h | 2 +- target/arm/debug_helper.c | 11 +++++------ target/arm/helper-a64.c | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index fbb69e6919..09d25612af 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1308,6 +1308,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu); void aa32_max_features(ARMCPU *cpu); bool arm_singlestep_active(CPUARMState *env); -bool arm_generate_debug_exceptions(CPUARMState *env); +bool arm_generate_debug_exceptions(CPUARMState *env, int cur_el); #endif diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 8d87b65a8d..a5363a5048 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -94,10 +94,8 @@ static bool aa32_generate_debug_exceptions(CPUARMState *env, int cur_el) * CheckSoftwareStep(), where it is elided because both branches would * always return the same value. */ -bool arm_generate_debug_exceptions(CPUARMState *env) +bool arm_generate_debug_exceptions(CPUARMState *env, int cur_el) { - int cur_el = arm_current_el(env); - if (is_a64(env)) { return aa64_generate_debug_exceptions(env, cur_el); } else { @@ -111,9 +109,10 @@ bool arm_generate_debug_exceptions(CPUARMState *env) */ bool arm_singlestep_active(CPUARMState *env) { + int cur_el = arm_current_el(env); return extract32(env->cp15.mdscr_el1, 0, 1) && arm_el_is_aa64(env, arm_debug_target_el(env)) - && arm_generate_debug_exceptions(env); + && arm_generate_debug_exceptions(env, cur_el); } /* Return true if the linked breakpoint entry lbn passes its checks */ @@ -309,7 +308,7 @@ static bool check_watchpoints(ARMCPU *cpu) * exceptions here then watchpoint firings are ignored. */ if (extract32(env->cp15.mdscr_el1, 15, 1) == 0 - || !arm_generate_debug_exceptions(env)) { + || !arm_generate_debug_exceptions(env, arm_current_el(env))) { return false; } @@ -333,7 +332,7 @@ bool arm_debug_check_breakpoint(CPUState *cs) * exceptions here then breakpoint firings are ignored. */ if (extract32(env->cp15.mdscr_el1, 15, 1) == 0 - || !arm_generate_debug_exceptions(env)) { + || !arm_generate_debug_exceptions(env, arm_current_el(env))) { return false; } diff --git a/target/arm/helper-a64.c b/target/arm/helper-a64.c index 22db213aab..fe2a0aa261 100644 --- a/target/arm/helper-a64.c +++ b/target/arm/helper-a64.c @@ -924,7 +924,7 @@ void HELPER(exception_return)(CPUARMState *env, uint64_t new_pc) * We check 1 here and 2 after we've done the pstate/cpsr write() to * transition to the EL we're going to. */ - if (arm_generate_debug_exceptions(env)) { + if (arm_generate_debug_exceptions(env, cur_el)) { spsr &= ~PSTATE_SS; }