From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570182; cv=none; d=zohomail.com; s=zohoarc; b=ddlAhy6jYDK82ZU5xbnykxzQHAmQYcrM6Wx7lBObdYvhkKWxBLp1igYrayAY31sAYRcML+N7TmHLFk37s+gjqp47qxkoR+t34k61dPcBYg+h7Bl4kTiGKoUrk/g58Zz4BYk4OSQS6RvLXabm5vqO871G+3ujpxep0yOT+A9RNPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570182; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w/iHX6ANtN/zAKSj1imBD0tjZXjeiBLskpYlkOhgS0I=; b=g5XksDH91yXevaipxHh7JRD7ToncO9xLRz+ACLrLzo2CLAfPnevYM7Wm8k5ree1q5xCGr+HEtkGHWeq2Pav3WL7G0V0vHlpn2aVG9dekLgincUY50ftzWdV17hLQn8az8cU5h7qrKjGhp5r0DJAmEE84FUv5te/EnyioLMBgfr8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570182418621.2188452539411; Mon, 6 Jun 2022 19:49:42 -0700 (PDT) Received: from localhost ([::1]:56602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPHp-0001pY-E5 for importer@patchew.org; Mon, 06 Jun 2022 22:49:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60964) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFt-0006UU-3d for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:41 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:41613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFq-0000Gj-3Z for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:40 -0400 Received: by mail-pg1-x52c.google.com with SMTP id e66so14528830pgc.8 for ; Mon, 06 Jun 2022 19:47:37 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:36 -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=w/iHX6ANtN/zAKSj1imBD0tjZXjeiBLskpYlkOhgS0I=; b=l/7OOMPftewRQ7d5M9h66/VaR4dPsLiZn0T3Qs6jObKZiZgQzo1vMpuKLQ3YiN6bVB miMOTc7eKix0N4ZYFb7CmR0z2RJ2u2G4m1BzyjDPJ7Em+sOIA28o00VV4yTUvvOsoOQl 52mSktWwu/0VnlUHnRxSemyfRobgjkQCHr8V+BM7mm8I/zA1Kz8NJPfvAsefICOiLMKT 7lndCtyo7ViLUPteE0lHy4NhaMFwlZ8Dchlf8gAfl+mA9N7XsCBETZ4vOGHpPEtOwbhv Xv1ZGQR15UPtdY8BvAjOaXUPRHVvuDMi/vZo/VWgmKG3GpJMFlEaUye+AGc2BIvxL8do 6ryQ== 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=w/iHX6ANtN/zAKSj1imBD0tjZXjeiBLskpYlkOhgS0I=; b=WtMuWCe6r8NaSHVhqhpdPBpZIfScVxNNrT3arYrZ7tZhDuhfc8TjqmmgKNwFN5QDMj 2pzs8JZYALIzH+nwjDqWnTvmh5YjrwEo/O+nBmSs1r1U3tMJsVz2u3k/Svjygao4Lhhf U1TGfv4HQnlsl/HABB+oVhl3YvNla2AvsFKKxNoIlipOOYQ2iE6mV57722GUigvAbTTe lG1bKQKZZAxMUH5JUCj25U9WldaG6M+cAJxFxsgzfVx3Lm1rGg9QLO1pW6yBb+nTZhh+ 0yiFC0sa25yTrKkedNOiRi7+5T3QcjKEP2BuOdC4oX3jF100j7q4HVxGRY4z4f1PiOnl +icw== X-Gm-Message-State: AOAM5313uvBX74D3tdAWS2XhnuGF3oFOXhFKPu+blxPf7Q8iWN4vX6Ka 3gfEPaZovOjMvfTT0ms5QfrABj4YTFCHSQ== X-Google-Smtp-Source: ABdhPJyi299yVhcAdOOUfg+pVKZkWCPX2cIzsMDU5S80yIymESwriEI39MGBlAa00Li91zPwQvGwYg== X-Received: by 2002:a65:5385:0:b0:3fa:52e3:6468 with SMTP id x5-20020a655385000000b003fa52e36468mr23849622pgq.366.1654570056819; Mon, 06 Jun 2022 19:47:36 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 01/25] target/arm: Mark exception helpers as noreturn Date: Mon, 6 Jun 2022 19:47:10 -0700 Message-Id: <20220607024734.541321-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570183216100007 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index b1334e0c42..5161cdf73d 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -44,9 +44,9 @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i= 32) =20 DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) -DEF_HELPER_2(exception_internal, void, env, i32) -DEF_HELPER_4(exception_with_syndrome, void, env, i32, i32, i32) -DEF_HELPER_2(exception_bkpt_insn, void, env, i32) +DEF_HELPER_2(exception_internal, noreturn, env, i32) +DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32) +DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570597; cv=none; d=zohomail.com; s=zohoarc; b=OreHRIDjP/OBY8JVJ0QtJ35KSc+Xk/mcyv1EQOk0AZEtyLZcxXcINnXXrBfk6QWZCu6mBtLZh2JaGUbVGCVr5KQEYIkaTEeqfxd4CYbXXUTXcpSNX4fhM4OxvX4jSGB9RM2odEd1i40u/PgY180Omybif30aVZVjfYUxWZjsxAg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570597; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T8AfpmQwL0+E6fQxm6ojECpdw/9TThJiZv66f6M94Xg=; b=PCfcDSfX0G5T3Cek1P8/Jv+dc42Sedgs5Z9AyjSFtTyPxiSioqijTbq4GO3VRd45c3cgWYn5JL2AbgNuo1n/oY2xdgVM8X1wy5XIEJLFXNoWvH/ahB4qI7acaw1XzMODccFn3sOK4FdSRhoGzgOHy+XAcNBuZZNZuf0C/85WoE8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570597710711.3769394286599; Mon, 6 Jun 2022 19:56:37 -0700 (PDT) Received: from localhost ([::1]:46906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPOW-0005s4-N4 for importer@patchew.org; Mon, 06 Jun 2022 22:56:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFx-0006ee-6Q for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:45 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:43973) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFq-0000Gw-Rt for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:44 -0400 Received: by mail-pl1-x629.google.com with SMTP id b5so13641058plx.10 for ; Mon, 06 Jun 2022 19:47:38 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:37 -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=T8AfpmQwL0+E6fQxm6ojECpdw/9TThJiZv66f6M94Xg=; b=YTsaaHAYR0BLZT+M420CbUXR8IC/0ANMMBDZrQ+OedSOF513xc0LHmg0tad5fb4OWw v8xVuOYgfqnMLjuBwnYsAdlWPDBKgSvL5GpNjsNNsFB3K0d5jtmzih4Mrh5d+4tu0DPj ZHPTp+F78A1LuFeaV5VmvHIgSasmiXPVIIYPA4BserO+kLGzqwYigOFkT7lEeD3eNWuq n+6/JRNELAJL34DgUPbSi6susoiAdjUmd+tCGO8GPC7cB00dnqTczc69c6qCg8UQ3+IE 92U5oGzWYCwqt4kI7imXzsYB9quay9rDpnFwDkudS4iOjCe60BTK1RFJDyoCAEjfkIJq MHrw== 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=T8AfpmQwL0+E6fQxm6ojECpdw/9TThJiZv66f6M94Xg=; b=wNQm20frRj2T7tpn7070R22YVByrvB2tgYOOMxOOXi20HT+dzhNBZPWPnnCnn8bdC+ 93PZC/oeB7b24GP6MnVQV+YcYW+SdVpG41e4lNxE0MSkqiOLAZ8ViGHy+MKduib3owb1 6vIBQ8sRyn+9EZddJxUVuhCmIK2kIVh7MM7/STfzmzfcAhdPpj/55mg4fk7TGkg4kJN3 48i2NKnyDhg9Vfga1/hPnPYG197YxpjhdKjXN1RREKU0PCACn24vgeFZypGg3Dh3myZD 82mTlgu7yPygRFKxfJqr72xCDcx7uO+HBkyX3Z7aS2/Ue7ElHiJlsBIxzFmfb4R5pGQl EG/Q== X-Gm-Message-State: AOAM53213AUCWHlnQ3n58TV5JNKyIjoURxaoctrb8pQa9oNXPeUjOBbY SKptTxECuEXpeuoh9FtDN1lKH3ZgXmCYZg== X-Google-Smtp-Source: ABdhPJyRESZpbqsA47M1DNLRoKYsEaE7KKcbTCpotx1kn4rn0mZRcSQkXUGxNwgfucsUKxYVeZk3Dg== X-Received: by 2002:a17:902:e80b:b0:167:5e77:e697 with SMTP id u11-20020a170902e80b00b001675e77e697mr15713154plg.93.1654570057544; Mon, 06 Jun 2022 19:47:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 02/25] target/arm: Add coproc parameter to syn_fp_access_trap Date: Mon, 6 Jun 2022 19:47:11 -0700 Message-Id: <20220607024734.541321-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570598520100001 Content-Type: text/plain; charset="utf-8" With ARMv8, this field is always RES0. With ARMv7, targeting EL2 and TA=3D0, it is always 0xA. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/syndrome.h | 7 ++++--- target/arm/translate-a64.c | 3 ++- target/arm/translate-vfp.c | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h index 0cb26dde7d..c105f9e6ba 100644 --- a/target/arm/syndrome.h +++ b/target/arm/syndrome.h @@ -185,12 +185,13 @@ static inline uint32_t syn_cp15_rrt_trap(int cv, int = cond, int opc1, int crm, | (rt2 << 10) | (rt << 5) | (crm << 1) | isread; } =20 -static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit) +static inline uint32_t syn_fp_access_trap(int cv, int cond, bool is_16bit, + int coproc) { - /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA =3D=3D 0 coproc =3D= =3D 0xa */ + /* AArch32 FP trap or any AArch64 FP/SIMD trap: TA =3D=3D 0 */ return (EC_ADVSIMDFPACCESSTRAP << ARM_EL_EC_SHIFT) | (is_16bit ? 0 : ARM_EL_IL) - | (cv << 24) | (cond << 20) | 0xa; + | (cv << 24) | (cond << 20) | coproc; } =20 static inline uint32_t syn_simd_access_trap(int cv, int cond, bool is_16bi= t) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 935e1929bb..14b90a37ea 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1162,7 +1162,8 @@ static bool fp_access_check(DisasContext *s) s->fp_access_checked =3D true; =20 gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_fp_access_trap(1, 0xe, false), s->fp_excp_e= l); + syn_fp_access_trap(1, 0xe, false, 0), + s->fp_excp_el); return false; } s->fp_access_checked =3D true; diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 40a513b822..0f797c56fd 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -219,8 +219,18 @@ static void gen_update_fp_context(DisasContext *s) static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled) { if (s->fp_excp_el) { - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_fp_access_trap(1, 0xe, false), s->fp_excp_e= l); + /* + * The full syndrome is only used for HSR when HCPTR traps: + * For v8, when TA=3D=3D0, coproc is RES0. + * For v7, any use of a Floating-point instruction or access + * to a Floating-point Extension register that is trapped to + * Hyp mode because of a trap configured in the HCPTR sets + * this field to 0xA. + */ + int coproc =3D arm_dc_feature(s, ARM_FEATURE_V8) ? 0 : 0xa; + uint32_t syn =3D syn_fp_access_trap(1, 0xe, false, coproc); + + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el); return false; } =20 --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570369; cv=none; d=zohomail.com; s=zohoarc; b=MiHmsOr06O1Tv5l2jP3V7oDWUwMVbESgUHbUk4ss6wr5KiZCDWq//L/7q4dYmlZIsg9/PTB53YBquLOdLszqJodzzhwK0b3sU8WssjSCPL7bEKQquEGi/JNvRXaHgLiX8g6M6wUFRibRYPdoATSxYKspa0dSOszD0uVkCxkCAuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570369; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vyyg44YF2Y/mmVGaXvfp7YJNYhSRY+k5gyUVMMceFu0=; b=OL5p6d/+TCyLe6b+jfJ/QBKmleUHJ44Y8WOUXwvT1y7YWiaHA09rLrHRXLXiQebNN1ZQp8GqFcdJy7uc2NxC5SYU9p7L0QmDmRWufM9lPLVxr1jSmGm5lcuPxrT9Og1DXQaK3aKKkTe1+FwY0ek5AqjRk8ddIYavA8UaK1DOaWo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570369039279.850741134701; Mon, 6 Jun 2022 19:52:49 -0700 (PDT) Received: from localhost ([::1]:37130 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPKq-0007jW-1D for importer@patchew.org; Mon, 06 Jun 2022 22:52:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFw-0006cP-GF for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:44 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:34515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFr-0000H8-N2 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:43 -0400 Received: by mail-pj1-x1032.google.com with SMTP id mh16-20020a17090b4ad000b001e8313301f1so6821404pjb.1 for ; Mon, 06 Jun 2022 19:47:39 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:37 -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=vyyg44YF2Y/mmVGaXvfp7YJNYhSRY+k5gyUVMMceFu0=; b=YtLN5NL/SuUJYB+B2n5PsAKkkVF7Vj7pJifU2gWBKNFD6aXmnoj5RlPKj2GzWuKCwu JmRsCAYAz8yaLrPGkFzJrYSv1aI6g37xQRGkNkHD19YRQkjuov3fo2cBjIjyzViQu5+p 9I7gnAFwsGEajNoRhG3qTiSVUwbE3+uCBe6TDmwWN+Mpv3a+aMusqru1lYBNsaoS3+j0 odem/PFJvHxEXUI3MaLPHCoLxCax0J4W3ckc2Asth7elYJqK3j1O+Z72klk23rHpcqk/ SZslsVtzJN0kWbD1tOnUyg5PWQE2it1/1PPAmXn9BdqktfAFE2+TvTK4x93U6JM/VwtU DRHg== 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=vyyg44YF2Y/mmVGaXvfp7YJNYhSRY+k5gyUVMMceFu0=; b=wLmtOhmVRYgUjYiRWB9Vp3gkOZOaVfmNqrttIP4w3Vfd3wJy/RBFduT9GD1u1905De 9FCLUFMSgW/oTKhPw3xQfPWHa7/bigwCrKrwTNPKW9i1pUziGUQ72BxjV8XEPn5yvM7v vlue3m7CqucvmTxGAmsMCkJALhW2dxxElELFZw1sn4i/MbyoaEGjVTIK0fid0Q9+Rfyq DqYQcntcjKoK1MRkAuMNO3m0qv3lxU58ydvygCsFkD0s8PKXAHhFfIr5jXSmjJMLNU09 hoqMxGQuig9+es2ZdUeehSTASptncbUG9Yi7oPMONOpo/oNNlMUFzW6arSxf2Nfx9eQs KOnw== X-Gm-Message-State: AOAM531+yI4rvo94ggIcOXiMNYtBssFzj2Pchpm/INqCyo88EcJhCzau 7BlbMGDZRru7ZALVKE5aVPNqn7ePXS1Kvw== X-Google-Smtp-Source: ABdhPJzPI2mufyLkUn1dm2/KzKXdjCCXQctffuY82su91hqT9k4lc5ZjB2iDmzyMa7fPnrCc4/yruA== X-Received: by 2002:a17:90b:4c4e:b0:1e3:368b:c09c with SMTP id np14-20020a17090b4c4e00b001e3368bc09cmr29414260pjb.140.1654570058279; Mon, 06 Jun 2022 19:47:38 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 03/25] target/arm: Move fp access syndrome adjust out of raise_exception Date: Mon, 6 Jun 2022 19:47:12 -0700 Message-Id: <20220607024734.541321-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570370534100001 Content-Type: text/plain; charset="utf-8" Create helper_exception_advsimdfp_access to handle both the routing and the syndrome contents, depending on the eventual target EL and mode. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 1 + target/arm/translate.h | 9 +++++++++ target/arm/op_helper.c | 32 +++++++++++++++++++++++--------- target/arm/translate-a64.c | 5 ++--- target/arm/translate-vfp.c | 4 +++- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index 5161cdf73d..a13007699d 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -46,6 +46,7 @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_2(exception_internal, noreturn, env, i32) DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32) +DEF_HELPER_3(exception_advsimdfp_access, noreturn, env, i32, i32) DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) DEF_HELPER_1(setend, void, env) diff --git a/target/arm/translate.h b/target/arm/translate.h index 9f0bb270c5..da5f89d49d 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -337,6 +337,15 @@ static inline void gen_exception(int excp, uint32_t sy= ndrome, tcg_constant_i32(target_el)); } =20 +static inline void gen_exception_advsimdfp_access(DisasContext *s, + uint32_t syndrome) +{ + gen_helper_exception_advsimdfp_access(cpu_env, + tcg_constant_i32(syndrome), + tcg_constant_i32(s->fp_excp_el)); + s->base.is_jmp =3D DISAS_NORETURN; +} + /* Generate an architectural singlestep exception */ static inline void gen_swstep_exception(DisasContext *s, int isv, int ex) { diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c4bd668870..67b7dbeaa9 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -34,16 +34,8 @@ void raise_exception(CPUARMState *env, uint32_t excp, CPUState *cs =3D env_cpu(env); =20 if (target_el =3D=3D 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { - /* - * Redirect NS EL1 exceptions to NS EL2. These are reported with - * their original syndrome register value, with the exception of - * SIMD/FP access traps, which are reported as uncategorized - * (see DDI0478C.a D1.10.4) - */ + /* Redirect NS EL1 exceptions to NS EL2. */ target_el =3D 2; - if (syn_get_ec(syndrome) =3D=3D EC_ADVSIMDFPACCESSTRAP) { - syndrome =3D syn_uncategorized(); - } } =20 assert(!excp_is_internal(excp)); @@ -384,6 +376,28 @@ void HELPER(exception_with_syndrome)(CPUARMState *env,= uint32_t excp, raise_exception(env, excp, syndrome, target_el); } =20 +/* Raise an exception with EC_ADVSIMDFPACCESS. */ +void HELPER(exception_advsimdfp_access)(CPUARMState *env, + uint32_t syndrome, uint32_t target= _el) +{ + if (target_el =3D=3D 1 && (arm_hcr_el2_eff(env) & HCR_TGE)) { + /* + * SIMD/FP access traps, when re-routed to EL2, are reported with + * uncategorized syndrome. See DDI0487H.a rule RJNBTN. + */ + target_el =3D 2; + syndrome =3D syn_uncategorized(); + } else if (arm_el_is_aa64(env, target_el)) { + /* + * From AArch32, we will have filled in TA and/or COPROC for use + * by aa32 HSR. But in aa64 ESR_ELx, the low 20 bits are RES0. + */ + syndrome &=3D 0xfff00000; + } + + raise_exception(env, EXCP_UDEF, syndrome, target_el); +} + /* Raise an EXCP_BKPT with the specified syndrome register value, * targeting the correct exception level for debug exceptions. */ diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 14b90a37ea..3251c69180 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1161,9 +1161,8 @@ static bool fp_access_check(DisasContext *s) assert(!s->fp_access_checked); s->fp_access_checked =3D true; =20 - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_fp_access_trap(1, 0xe, false, 0), - s->fp_excp_el); + gen_a64_set_pc_im(s->pc_curr); + gen_exception_advsimdfp_access(s, syn_fp_access_trap(1, 0xe, false= , 0)); return false; } s->fp_access_checked =3D true; diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 0f797c56fd..2a98387411 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -230,7 +230,9 @@ static bool vfp_access_check_a(DisasContext *s, bool ig= nore_vfp_enabled) int coproc =3D arm_dc_feature(s, ARM_FEATURE_V8) ? 0 : 0xa; uint32_t syn =3D syn_fp_access_trap(1, 0xe, false, coproc); =20 - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el); + gen_set_condexec(s); + gen_set_pc_im(s, s->pc_curr); + gen_exception_advsimdfp_access(s, syn); return false; } =20 --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570169; cv=none; d=zohomail.com; s=zohoarc; b=J2lOqRQEBEAwjOHAI0nJG7PMkqLg9GrRGbxK11ywbkkrBFIZwXph+8vA8gx07ocI/EXpz9iXaFqy0OjJ9e1muMD7fMs3w2Ee7LHDHiDdVLVNAxPJ/NlCUd/Xf1mmyVPaxBIvewfg8n65E0+Ad6HgjFjDrIjYejwg43yiQFtpM7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570169; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6L8pt/IhJxuBRjI6bUDUlD7xMciX/G+qjq8VDpWp4w4=; b=JC8IFGhfuWqEfLgVfx4BwM+tgU5a1xkHuhovrlOrTlUVVxriOfhunE8zAOihJrGqIjigy3TUjp+d3afIt6BKGhp+I/q3mDFjhf5/DZK+rly8zFYPdTd0s0ox/+gWf3vuoZBPTJWAf3wEqOWfW85UW5z0sOmrmRgK0A02miro8wg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165457016987169.88517623992266; Mon, 6 Jun 2022 19:49:29 -0700 (PDT) Received: from localhost ([::1]:55500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPHc-00015i-BP for importer@patchew.org; Mon, 06 Jun 2022 22:49:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFu-0006XJ-Bg for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:42 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:34517) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFs-0000HP-D8 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:42 -0400 Received: by mail-pj1-x1034.google.com with SMTP id mh16-20020a17090b4ad000b001e8313301f1so6821424pjb.1 for ; Mon, 06 Jun 2022 19:47:39 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:38 -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=6L8pt/IhJxuBRjI6bUDUlD7xMciX/G+qjq8VDpWp4w4=; b=qRkGDEkNyWcQjH8cmaHXBhPMVs/n7G0U0y29nKaTNrN5dV9Lc2ucPLnyC4vkxMf6qX 31eVKcGC8M+k9pZBOgLZr1ZScnnWHUEDYRnfgTt8Rlm6mP4iQl3YehPCOIDUoVyPNfWK zaSyk28EQtaXDDx9N5ZvZjkfxqCMrJWdb0fxfoeTwtHa9nXNmExm5aWR3PVrHWW/SmVE WlxZmrCofkbVWXgWoaVNu2/FOLD5xmr5PBa0fspXWbdzw3/0R9N0pNE5uUglYUPrO+mA aWCxeLUqTCQoxlVJk/+NbAXYdOE8YmCEDi+2067MGx8nZxc5y23sP0BSaK9GUel7lrml GvDA== 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=6L8pt/IhJxuBRjI6bUDUlD7xMciX/G+qjq8VDpWp4w4=; b=vuAj+AQfKAAiTfALFcT/ozFF1hoQy0IczNDQFEfIsjFqeh3BVEFeWJeufsJ/vHfche MThZq053hEORnc40eUQ8Zgz+OP2plM7A2mnQAT+RgBoCXNxVAxwPCdLPI8sc+NJd9FFY yD05jURJqBuBmc4/qBEfzpv3JYvFy588A5SZbNqiA4JDzljDBOwzzwP8Qe51GBoOD2oz kswujssSMZkxukJzj8Cq2z2Qx7RvewCklLfO+b8ZigIuKMRYOElms0RFRJ9Nxyk0oSpL eLJlnDDIE2n4Quka3YvagtMLg+06jEUOpXmMMJMS6b0ZfASpXOP0IXaZAn6bVptqdwcu F0vA== X-Gm-Message-State: AOAM533v3yG7Ew9PRKXGTkU280ioMMWnvnDAKAY2c56rgLMTkCre1zjs iba+A3KFsl6Co2WTo89dKWTsr7OiV09w9g== X-Google-Smtp-Source: ABdhPJyCobXhwN5tIu3sTsexJ91c7hTvzV8Hqbw14TY+2dEiEie8hV5MvzGXWNmCrp7ae9SEfll3aw== X-Received: by 2002:a17:90a:5206:b0:1e0:ab19:5f41 with SMTP id v6-20020a17090a520600b001e0ab195f41mr29954440pjh.142.1654570059104; Mon, 06 Jun 2022 19:47:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 04/25] target/arm: Move exception_target_el out of line Date: Mon, 6 Jun 2022 19:47:13 -0700 Message-Id: <20220607024734.541321-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570171188100003 Content-Type: text/plain; charset="utf-8" Move the function to op_helper.c, near raise_exception. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/internals.h | 16 +--------------- target/arm/op_helper.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index b654bee468..36c33a6ac5 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1090,21 +1090,6 @@ typedef struct ARMVAParameters { ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va, ARMMMUIdx mmu_idx, bool data); =20 -static inline int exception_target_el(CPUARMState *env) -{ - int target_el =3D MAX(1, arm_current_el(env)); - - /* - * No such thing as secure EL1 if EL3 is aarch32, - * so update the target EL to EL3 in this case. - */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el =3D=3D = 1) { - target_el =3D 3; - } - - return target_el; -} - /* Determine if allocation tags are available. */ static inline bool allocation_tag_access_enabled(CPUARMState *env, int el, uint64_t sctlr) @@ -1329,5 +1314,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); #endif =20 void aa32_max_features(ARMCPU *cpu); +int exception_target_el(CPUARMState *env); =20 #endif diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 67b7dbeaa9..00a082d1f7 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -28,6 +28,21 @@ #define SIGNBIT (uint32_t)0x80000000 #define SIGNBIT64 ((uint64_t)1 << 63) =20 +int exception_target_el(CPUARMState *env) +{ + int target_el =3D MAX(1, arm_current_el(env)); + + /* + * No such thing as secure EL1 if EL3 is aarch32, + * so update the target EL to EL3 in this case. + */ + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3) && target_el =3D=3D = 1) { + target_el =3D 3; + } + + return target_el; +} + void raise_exception(CPUARMState *env, uint32_t excp, uint32_t syndrome, uint32_t target_el) { --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570641; cv=none; d=zohomail.com; s=zohoarc; b=QHzdBFBnrTzpLw9wmPVyGHv0q2b6i7gLifXvFwwdv9q6CogaPQ2v5OxCu5X0Q6C5jnZBl/hviEmRxNl6qCn7Up91856nYSgBk5kysUs+8KNHbZtbNZ2HQwUS2yEgac1cDg5JQXcFAf/akSm5/VDn2ly2/n06XS/LIN7lBcub29A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570641; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SyvEw0v6kbVYTBLHikS3UDLCGmQvw9Yz1NNALVd/Wyo=; b=PCV4Y8dg46NcITp0zoJ4Mau/wbumOJRO/waoiemRAB9LC7BRQ27l0u3iGQ3W0nfRIMxe5fvJDAUlG58v2CoCAoE6Z6XGwpZcbvyrs42Fdq9g0+w5LKyFOxk+7a11FRDprFMHK9e1j/FQc6f+u6Yhwe6otQ4Gb8hjFQ/vOiLiFMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570641093720.6203992103622; Mon, 6 Jun 2022 19:57:21 -0700 (PDT) Received: from localhost ([::1]:49424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPPE-0007bY-3r for importer@patchew.org; Mon, 06 Jun 2022 22:57:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG5-00075O-9b for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:53 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:42675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFt-0000Hf-73 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:52 -0400 Received: by mail-pj1-x102a.google.com with SMTP id d12-20020a17090abf8c00b001e2eb431ce4so14214012pjs.1 for ; Mon, 06 Jun 2022 19:47:40 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:39 -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=SyvEw0v6kbVYTBLHikS3UDLCGmQvw9Yz1NNALVd/Wyo=; b=MBUKvjyrwR4arOEVmAGOy6mwQkAapGNZLmSgHPucF0q9w2GSR+Y3ddqNSh1gthAq74 r2GXkomWUFne7L8d1dIR3sElpL8NCx0pzCiM5WEmEtvYZoQZ0e6vxaZ7gcsOPXJo8kXe T/vmE2fE0LEWsIUfpzrxQgqETP+yZyyrob6g4Gm4mRUJqleVVw+wuF3wNJ5Bj9eptgu4 0KxNEL2YkrhOozC8AeYABroTwCP8SQ0ej3Hk9v0boo+5qsOnyKo2M+AzSA0r8yrMO/S9 G+b9uU4LzHmEoJn+7fxBo3Tolt/jpOlMluQtnPL5VJFZhzJbDgOcTDquQg5lpAX19I+N SIyw== 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=SyvEw0v6kbVYTBLHikS3UDLCGmQvw9Yz1NNALVd/Wyo=; b=XJaMScvWfrb7Cu9YU277S2+jGSghcmXzjDpbpQ1LWhB1ouAVUqXBJcalW2RBuxJtDm VBtM/V6ExUWkWKwNSfP9OS5Gn9wF3LIPX0FfPmOPS/0kg3eecdX6a6berI/g7T2iYuU/ cMSDFwcPcOZ/wUe3yxPJi2CGJqS7E+MnCyZUXJV1oWcI7PQBuWjQ70OdNQmpOcYOrVqR 8AC/FjxQCGmDKm4Ho0sI3e7GPutqKCjeCTA8HFC/cbdE9y/SPujsRnYoaCMT0XdMdNri i20zWgFJ6VAxf7Cxz6hjunxARVtRIxX6yzV5Aayai2rwkcxc4/sdIiTdamSdMqGsr8+d lPVw== X-Gm-Message-State: AOAM53366mlwoduiL0LPQJfEhNmmXOibWo3m0y+IerN1AXJakRCq/9zF uw06KCnCCwknYXLSq4BIMtUnN+PtWgPpAw== X-Google-Smtp-Source: ABdhPJz0j3sQlrWw6x7dTm0YLq2c6XRuDv/egWJq4/VDKK1mNXkpyZd96Qy9tU3mVDiSLGWRaReVCA== X-Received: by 2002:a17:90b:170b:b0:1e8:6d34:eba6 with SMTP id ko11-20020a17090b170b00b001e86d34eba6mr12740077pjb.105.1654570059849; Mon, 06 Jun 2022 19:47:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 05/25] target/arm: Move arm_singlestep_active out of line Date: Mon, 6 Jun 2022 19:47:14 -0700 Message-Id: <20220607024734.541321-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570642715100003 Content-Type: text/plain; charset="utf-8" Move the function to debug_helper.c, and the declaration to internals.h. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 10 ---------- target/arm/internals.h | 1 + target/arm/debug_helper.c | 12 ++++++++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index c1865ad5da..2e115a0281 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3087,16 +3087,6 @@ static inline bool arm_generate_debug_exceptions(CPU= ARMState *env) } } =20 -/* Is single-stepping active? (Note that the "is EL_D AArch64?" check - * implicitly means this always returns false in pre-v8 CPUs.) - */ -static inline bool arm_singlestep_active(CPUARMState *env) -{ - return extract32(env->cp15.mdscr_el1, 0, 1) - && arm_el_is_aa64(env, arm_debug_target_el(env)) - && arm_generate_debug_exceptions(env); -} - static inline bool arm_sctlr_b(CPUARMState *env) { return diff --git a/target/arm/internals.h b/target/arm/internals.h index 36c33a6ac5..148f2a9252 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1315,5 +1315,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); =20 void aa32_max_features(ARMCPU *cpu); int exception_target_el(CPUARMState *env); +bool arm_singlestep_active(CPUARMState *env); =20 #endif diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 46893697cc..1abf41c5f8 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -11,6 +11,18 @@ #include "exec/exec-all.h" #include "exec/helper-proto.h" =20 + +/* + * Is single-stepping active? (Note that the "is EL_D AArch64?" check + * implicitly means this always returns false in pre-v8 CPUs.) + */ +bool arm_singlestep_active(CPUARMState *env) +{ + return extract32(env->cp15.mdscr_el1, 0, 1) + && arm_el_is_aa64(env, arm_debug_target_el(env)) + && arm_generate_debug_exceptions(env); +} + /* Return true if the linked breakpoint entry lbn passes its checks */ static bool linked_bp_matches(ARMCPU *cpu, int lbn) { --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570398; cv=none; d=zohomail.com; s=zohoarc; b=C0cBqf2uSEOTl04y+N0scF7TYjv0v9xZIna3s00zT6P2rhQP29DPqgDvb346paOI9dz/M/k4CksEu2KFS3F4JBEIFAwC7z1SMsipTayiOaKxIEvsRMGFQHMArrX92YDg3f3kDgdyg+LxdPN1NU4Qp+xw3eSAUEmJYvX9GzAfURA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570398; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=agb1KQVoHZp1Dq8M4FnweXRLwX+H5ZfT4A8G1UBDOMI=; b=WyypVNi7uSELIJIoQPcpHBfmKLmAQp9RDqRBETHTUA4RYmEoWeFVrDz4h9kHWSGZJ0MP+sbb+UPGDL0RWrf+V6Gz6/5wQ81ocLhCQlOyT1pp4gtZWRTGQCKrsGsdE8DVhVD8V4EFH3Yk08M0bVA81lRDY7EqhU+Bee73w8m1k0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16545703982481010.9037374190815; Mon, 6 Jun 2022 19:53:18 -0700 (PDT) Received: from localhost ([::1]:38166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPLJ-0008PF-4Q for importer@patchew.org; Mon, 06 Jun 2022 22:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFy-0006kw-Tg for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:46 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:39543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFu-0000I4-4e for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:46 -0400 Received: by mail-pj1-x102e.google.com with SMTP id q12-20020a17090a304c00b001e2d4fb0eb4so19520685pjl.4 for ; Mon, 06 Jun 2022 19:47:41 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:40 -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=agb1KQVoHZp1Dq8M4FnweXRLwX+H5ZfT4A8G1UBDOMI=; b=jYeLSqS+g7PJMp1Mv5FijSCvEE6kJLKqb28Yi6p5Y/ymIYsM7tKiavSEkODNXzGtjv F7VNthw7UfWuAlG0UfSFmy3MiLlJiYMOZ801Mlf3SiD9wHcFW5m9IPktfDUbCgq3jiye hRePyG224+ks1YteJMFoBLGolZZSDHhQv+5g8In/sIOOd49bqZqxmK9iMHG7m8Cy8N/t 1aGUsFMx5NqSrJNdyHZmYkGVhhQBgSsCuBOXp2IorYH23KW5/FuwsSyppd8QC9g0s8PQ 2fOX96NVmm+lrJRiX+I4zsQYiDtX8pHUuVYvS3mbUnK9yKys50hOFiLNNBLxT7KrcB56 cImw== 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=agb1KQVoHZp1Dq8M4FnweXRLwX+H5ZfT4A8G1UBDOMI=; b=TR22pOJoG7WsI0gBNgibXjj7eqg/pqNJckqJzSbDfeV1jDaqdyJa+mhdoF2vVp6SRL eqOI1pINynC3bXXOKeCECYbLOjG7xViuKEiroyV7RPXNU5/bDmFtMbDbujOPGpHrFv9V p9AjDP6nOUD4EwJbxxdeu8gZ62r1pymfq9AoWLL07gnUctL4S8qW2BYB81oFQkDFObmM sLOIORT6T7yqglIgyPMYvftuNREp9Sw78dTGBXVI8vQvU7IvHvrveZqh5o9aGm/sKMaa I8yp7x5DjfTnNEX9nRx+MG1s3Ji77U0oGOcB5UMBUZQC5zcAjT69U6+7yqZfObr968uD R9wQ== X-Gm-Message-State: AOAM531INpBxynGtLfCuOp63PYEteSJTYqQZvFK5t1X1cTc/j7lr4JEV 3OHTdEROAgZ3iVPAHIHFKHwWA5Sep9pf8g== X-Google-Smtp-Source: ABdhPJxsvggd6U0Oyp+4etMlg8SjEOgVX+3u66Gce4s6QQ9ljVoyMazTtjyM7k7Axj4Xn9kIFVbnGw== X-Received: by 2002:a17:90a:c7cf:b0:1e8:2b77:7835 with SMTP id gf15-20020a17090ac7cf00b001e82b777835mr23491945pjb.109.1654570060715; Mon, 06 Jun 2022 19:47:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 06/25] target/arm: Move arm_generate_debug_exceptions out of line Date: Mon, 6 Jun 2022 19:47:15 -0700 Message-Id: <20220607024734.541321-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570398576100003 Content-Type: text/plain; charset="utf-8" Move arm_generate_debug_exceptions and its two subroutines, {aa32,aa64}_generate_debug_exceptions into debug_helper.c, and the one interface declaration to internals.h. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.h | 91 ------------------------------------- target/arm/internals.h | 1 + target/arm/debug_helper.c | 94 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 91 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 2e115a0281..92c9758e86 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2996,97 +2996,6 @@ static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu) return (cpu->clidr & R_V7M_CLIDR_CTYPE_ALL_MASK) !=3D 0; } =20 -/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ -static inline bool aa64_generate_debug_exceptions(CPUARMState *env) -{ - int cur_el =3D arm_current_el(env); - int debug_el; - - if (cur_el =3D=3D 3) { - return false; - } - - /* MDCR_EL3.SDD disables debug events from Secure state */ - if (arm_is_secure_below_el3(env) - && extract32(env->cp15.mdcr_el3, 16, 1)) { - return false; - } - - /* - * Same EL to same EL debug exceptions need MDSCR_KDE enabled - * while not masking the (D)ebug bit in DAIF. - */ - debug_el =3D arm_debug_target_el(env); - - if (cur_el =3D=3D debug_el) { - return extract32(env->cp15.mdscr_el1, 13, 1) - && !(env->daif & PSTATE_D); - } - - /* Otherwise the debug target needs to be a higher EL */ - return debug_el > cur_el; -} - -static inline bool aa32_generate_debug_exceptions(CPUARMState *env) -{ - int el =3D arm_current_el(env); - - if (el =3D=3D 0 && arm_el_is_aa64(env, 1)) { - return aa64_generate_debug_exceptions(env); - } - - if (arm_is_secure(env)) { - int spd; - - if (el =3D=3D 0 && (env->cp15.sder & 1)) { - /* SDER.SUIDEN means debug exceptions from Secure EL0 - * are always enabled. Otherwise they are controlled by - * SDCR.SPD like those from other Secure ELs. - */ - return true; - } - - spd =3D extract32(env->cp15.mdcr_el3, 14, 2); - switch (spd) { - case 1: - /* SPD =3D=3D 0b01 is reserved, but behaves as 0b00. */ - case 0: - /* For 0b00 we return true if external secure invasive debug - * is enabled. On real hardware this is controlled by external - * signals to the core. QEMU always permits debug, and behaves - * as if DBGEN, SPIDEN, NIDEN and SPNIDEN are all tied high. - */ - return true; - case 2: - return false; - case 3: - return true; - } - } - - return el !=3D 2; -} - -/* Return true if debugging exceptions are currently enabled. - * This corresponds to what in ARM ARM pseudocode would be - * if UsingAArch32() then - * return AArch32.GenerateDebugExceptions() - * else - * return AArch64.GenerateDebugExceptions() - * We choose to push the if() down into this function for clarity, - * since the pseudocode has it at all callsites except for the one in - * CheckSoftwareStep(), where it is elided because both branches would - * always return the same value. - */ -static inline bool arm_generate_debug_exceptions(CPUARMState *env) -{ - if (env->aarch64) { - return aa64_generate_debug_exceptions(env); - } else { - return aa32_generate_debug_exceptions(env); - } -} - static inline bool arm_sctlr_b(CPUARMState *env) { return diff --git a/target/arm/internals.h b/target/arm/internals.h index 148f2a9252..e9ac54f244 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1316,5 +1316,6 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); void aa32_max_features(ARMCPU *cpu); int exception_target_el(CPUARMState *env); bool arm_singlestep_active(CPUARMState *env); +bool arm_generate_debug_exceptions(CPUARMState *env); =20 #endif diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 1abf41c5f8..20a0e4261a 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -12,6 +12,100 @@ #include "exec/helper-proto.h" =20 =20 +/* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ +static bool aa64_generate_debug_exceptions(CPUARMState *env) +{ + int cur_el =3D arm_current_el(env); + int debug_el; + + if (cur_el =3D=3D 3) { + return false; + } + + /* MDCR_EL3.SDD disables debug events from Secure state */ + if (arm_is_secure_below_el3(env) + && extract32(env->cp15.mdcr_el3, 16, 1)) { + return false; + } + + /* + * Same EL to same EL debug exceptions need MDSCR_KDE enabled + * while not masking the (D)ebug bit in DAIF. + */ + debug_el =3D arm_debug_target_el(env); + + if (cur_el =3D=3D debug_el) { + return extract32(env->cp15.mdscr_el1, 13, 1) + && !(env->daif & PSTATE_D); + } + + /* Otherwise the debug target needs to be a higher EL */ + return debug_el > cur_el; +} + +static bool aa32_generate_debug_exceptions(CPUARMState *env) +{ + int el =3D arm_current_el(env); + + if (el =3D=3D 0 && arm_el_is_aa64(env, 1)) { + return aa64_generate_debug_exceptions(env); + } + + if (arm_is_secure(env)) { + int spd; + + if (el =3D=3D 0 && (env->cp15.sder & 1)) { + /* + * SDER.SUIDEN means debug exceptions from Secure EL0 + * are always enabled. Otherwise they are controlled by + * SDCR.SPD like those from other Secure ELs. + */ + return true; + } + + spd =3D extract32(env->cp15.mdcr_el3, 14, 2); + switch (spd) { + case 1: + /* SPD =3D=3D 0b01 is reserved, but behaves as 0b00. */ + case 0: + /* + * For 0b00 we return true if external secure invasive debug + * is enabled. On real hardware this is controlled by external + * signals to the core. QEMU always permits debug, and behaves + * as if DBGEN, SPIDEN, NIDEN and SPNIDEN are all tied high. + */ + return true; + case 2: + return false; + case 3: + return true; + } + } + + return el !=3D 2; +} + +/* + * Return true if debugging exceptions are currently enabled. + * This corresponds to what in ARM ARM pseudocode would be + * if UsingAArch32() then + * return AArch32.GenerateDebugExceptions() + * else + * return AArch64.GenerateDebugExceptions() + * We choose to push the if() down into this function for clarity, + * since the pseudocode has it at all callsites except for the one in + * CheckSoftwareStep(), where it is elided because both branches would + * always return the same value. + */ +bool arm_generate_debug_exceptions(CPUARMState *env) +{ + if (env->aarch64) { + return aa64_generate_debug_exceptions(env); + } else { + return aa32_generate_debug_exceptions(env); + } +} + /* * Is single-stepping active? (Note that the "is EL_D AArch64?" check * implicitly means this always returns false in pre-v8 CPUs.) --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570180; cv=none; d=zohomail.com; s=zohoarc; b=e2VCHrL8a0OLtXHy6NPumI593tDIxiwpTdcaVTOC8KEqVfVAuuy/ROR7gAwE2YyHzgFUEABYCAwYrBPAEfXHMKGhlCnoL2Igv1RK/uSDDDuY/YFaHXJn7zwETf0h30DYRmjYwUsP6cAjsjhHiiQoyNlfs6aAukHJblo7laELerA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570180; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=teH34tLGM/uhEwiASP92UVNlQhKQkgbQt9R4Fk9V4dg=; b=ER+wE4yTgMwFoVRKS1ftQDNy4t4my4W62up51N4/DcNMYAoQDiDZj9masgglPKHAUYMe6kSgNpdrSN0Q9lujWSdd72dv77wN5yRpLI5CCDSXNowNSxQVMu6zeiUVJ183zVyEn1sPW2Lr6+Me5Q+N5Yu4L/R9x0qdiHpw0cVtxKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570180053822.3058381298624; Mon, 6 Jun 2022 19:49:40 -0700 (PDT) Received: from localhost ([::1]:56626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPHm-0001qH-HN for importer@patchew.org; Mon, 06 Jun 2022 22:49:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFx-0006fl-FI for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:45 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:45698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFu-0000JM-PZ for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:45 -0400 Received: by mail-pl1-x631.google.com with SMTP id q18so13632189pln.12 for ; Mon, 06 Jun 2022 19:47:42 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:41 -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=teH34tLGM/uhEwiASP92UVNlQhKQkgbQt9R4Fk9V4dg=; b=gcdJw8PQjwxJphlxitQ5kP9MJPPHKQx6YMh5MEbpxoI/s4h2t3VKHKRRFMzJjLXvHO oLIoeQy3DfTO8UnmheIXVRgNJGTGUgBimSmPhtJ94G1AAEleXFcxSnJjj/GX4RkB6Pcl j+fXSKyVHBBhedeAUIhrPYM6qUv/yx13kC+8drZ8bWzQ52cqLAFkiQiqhiOq0oQ3Ntps bUujdF8brbwFKErZQ6ZOCuQjpcQ9li/FgRnknoqeegQyNvQhYZugidXJe5DbsY0xiMLQ yptYMeWdDgXfGv0/y9NE2BTK5xqWt9vCkybarNCkcH1aCqh7PFF/NxdSXj/V5VVu3UOo P6zw== 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=teH34tLGM/uhEwiASP92UVNlQhKQkgbQt9R4Fk9V4dg=; b=8SO87+DZZI2yt4/MNvG3Jq/vm8BWkXqZ7NHbLEForWse850/6ZPkzCflJHrESAHGdl B/D2WWwz1aIkvUmCT9/22eeZ5IZn9BgGbid1ppr4xjJ76l10yfzEBIs0BZ51PloGn4iS 3eGtkEc4S2Mh0sDgnVVcQNTHqvvgZntE74aMLknJ7VZXsUXRqZCh/me2zbPSZgZy8Yz1 Sd9OrQi5B9gZMsfl2rYm5tkV5+avh3M8UEvPMvrwMo/tAgzqNXKmLH0QZsJthJe+DlPO WR1IO0oUqqj+Tt6Oam4KCoHvOMOMKJKxyEjwfs5SXCscqZfmi/46WhMu2ixHzLUJOl8H pcFg== X-Gm-Message-State: AOAM530C9iLwNMPt9L9JQMqFBiJjWOLA4KdOpK+GiMT8wTpfCAHz0OLK XxOzIA9iLISYUK+EdRp7sBoC1FpUn/toGQ== X-Google-Smtp-Source: ABdhPJxnzSWg8fzmhAD2L9Sox5ucKURLvm83TcPMdjWNhIdg8045ER0KIjICFu7vcladh59FdmwZmA== X-Received: by 2002:a17:90b:3850:b0:1e2:a755:162 with SMTP id nl16-20020a17090b385000b001e2a7550162mr29518194pjb.241.1654570061468; Mon, 06 Jun 2022 19:47:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v2 07/25] target/arm: Use is_a64 in arm_generate_debug_exceptions Date: Mon, 6 Jun 2022 19:47:16 -0700 Message-Id: <20220607024734.541321-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570181338100003 Content-Type: text/plain; charset="utf-8" Use the accessor rather than the raw structure member. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/debug_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 20a0e4261a..a18a09a0c3 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -99,7 +99,7 @@ static bool aa32_generate_debug_exceptions(CPUARMState *e= nv) */ bool arm_generate_debug_exceptions(CPUARMState *env) { - if (env->aarch64) { + if (is_a64(env)) { return aa64_generate_debug_exceptions(env); } else { return aa32_generate_debug_exceptions(env); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570398; cv=none; d=zohomail.com; s=zohoarc; b=eJo7pgd2whcxBzi5YNrPUi+VDHUHkO8sl7AHtVUsGgRNgw5m9VW0ox8dsgwwY5mntYZuwfGLgU3x22g6BBZK/BsigHS8hshpSV5VdQ0YeNNfAX3e0LxXr+vc4QxvWK5OOAUyizwcSYHEz70h2l6TosOWJnZ9DhPyPRK3IAHxFrI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570398; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=t3QqzZZIr7UgbN3ZekMQ8h5fse6DD+fMoam6hjgppWE=; b=oJ/XeHaFaVKYxpFQPi5tRz/IASgoHhjKp3g0cJJ18AHcttL/1jNQx2hAOrp6iHrsp/ReQFxz04YbgXTt5CAfDzLpr//rXnUiPeB8fzExukPdlsXX/LOyD/cbogoZ62jokLbcu2fpFP8T8N4IiZZdwMCBxaET+bM5rPBKJKfDD0A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570398541624.6140700008837; Mon, 6 Jun 2022 19:53:18 -0700 (PDT) Received: from localhost ([::1]:38222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPLJ-0008Ra-I6 for importer@patchew.org; Mon, 06 Jun 2022 22:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:32958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPFz-0006lB-1H for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:47 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:42680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFv-0000Jc-KY for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:46 -0400 Received: by mail-pj1-x102f.google.com with SMTP id d12-20020a17090abf8c00b001e2eb431ce4so14214085pjs.1 for ; Mon, 06 Jun 2022 19:47:43 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:42 -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=t3QqzZZIr7UgbN3ZekMQ8h5fse6DD+fMoam6hjgppWE=; b=CTmXMfS6FCWvfvnO5WPje6Oj9LPCpEKr1KhT25MLPj2UIBdFYDMmGH3xJ7DhED3peo /4LTy71tWBI7RWdTN5cQJ0+AVgposcFWpaPBDnQF1NaolNjx/gXvOkHrlKuDQuZxkPtT RQ0JPZPdZal7q3p5jZ8QduKRN6K/tsLd5LO52tUsfvZaZDd4QX9W7g7kAYXKa/W57QfI hqoyznEaXeA8JKEkRMyRKUm9nKXckupDbNlKXVjdkDNSTLwpsnvXmCSYT+r5lFYEneOx URlbNxeSoBZzlLd0kYlCkdktv3gkWSMyAo9VDk1/bPVYfr79H3d/jV3koQY8f4oLred+ e6sQ== 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=t3QqzZZIr7UgbN3ZekMQ8h5fse6DD+fMoam6hjgppWE=; b=nN/F8d8zskAjiEn26miF2pxWTUTteQ7QjCYcBg8uIqrRCZxrAyMJo2aFALWcrBW58r uxaJpDVbdvvMY8giphMYywTm87PSGDesjd89L6nUDI7VUTMPTynVOKZvZthaZghm+O8e T5JfkPFL0VwDvFF+ZlZaTJC5bsC3B9rGd35ywReBSr5R7gKoPi9iSTZNeSYTU34gjUZU T1JnncSUYJCsc+bndbCkrT+z6peqtTqOaQtZdNV96RtdUJMSOzzquGGguUz5PlGF4/YX 5cmkFDKt9bX6mjiRrRmVfiFGvAVfcuy6vvckv+vwryyak8LE2jgTE+7p6pBKz2POrYxu jEpQ== X-Gm-Message-State: AOAM530wCWIzN0KOpK5h1IH5fQ6cDYyIcl389Byg/WrTykeKKiY/DxYg HGhxB0P7uWLfsjN53GmipyoaKI4oMPIxEQ== X-Google-Smtp-Source: ABdhPJwwkeQvoE6xBsXy4mpGeT2It/cIkT/jmZDOrmNr5KXuHz/cKuYVSUF+IlLPuAwUjKEWSeYG8w== X-Received: by 2002:a17:90b:380b:b0:1e6:67f6:f70c with SMTP id mq11-20020a17090b380b00b001e667f6f70cmr32040077pjb.120.1654570062385; Mon, 06 Jun 2022 19:47:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 08/25] target/arm: Move exception_bkpt_insn to debug_helper.c Date: Mon, 6 Jun 2022 19:47:17 -0700 Message-Id: <20220607024734.541321-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570400553100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/debug_helper.c | 31 +++++++++++++++++++++++++++++++ target/arm/op_helper.c | 29 ----------------------------- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index a18a09a0c3..80dff0788b 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -430,6 +430,37 @@ void arm_debug_excp_handler(CPUState *cs) } } =20 +/* + * Raise an EXCP_BKPT with the specified syndrome register value, + * targeting the correct exception level for debug exceptions. + */ +void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) +{ + int debug_el =3D arm_debug_target_el(env); + int cur_el =3D arm_current_el(env); + + /* FSR will only be used if the debug target EL is AArch32. */ + env->exception.fsr =3D arm_debug_exception_fsr(env); + /* + * FAR is UNKNOWN: clear vaddress to avoid potentially exposing + * values to the guest that it shouldn't be able to see at its + * exception/security level. + */ + env->exception.vaddress =3D 0; + /* + * Other kinds of architectural debug exception are ignored if + * they target an exception level below the current one (in QEMU + * this is checked by arm_generate_debug_exceptions()). Breakpoint + * instructions are special because they always generate an exception + * to somewhere: if they can't go to the configured debug exception + * level they are taken to the current exception level. + */ + if (debug_el < cur_el) { + debug_el =3D cur_el; + } + raise_exception(env, EXCP_BKPT, syndrome, debug_el); +} + #if !defined(CONFIG_USER_ONLY) =20 vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 00a082d1f7..ae0009d1a3 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -413,35 +413,6 @@ void HELPER(exception_advsimdfp_access)(CPUARMState *e= nv, raise_exception(env, EXCP_UDEF, syndrome, target_el); } =20 -/* Raise an EXCP_BKPT with the specified syndrome register value, - * targeting the correct exception level for debug exceptions. - */ -void HELPER(exception_bkpt_insn)(CPUARMState *env, uint32_t syndrome) -{ - int debug_el =3D arm_debug_target_el(env); - int cur_el =3D arm_current_el(env); - - /* FSR will only be used if the debug target EL is AArch32. */ - env->exception.fsr =3D arm_debug_exception_fsr(env); - /* FAR is UNKNOWN: clear vaddress to avoid potentially exposing - * values to the guest that it shouldn't be able to see at its - * exception/security level. - */ - env->exception.vaddress =3D 0; - /* - * Other kinds of architectural debug exception are ignored if - * they target an exception level below the current one (in QEMU - * this is checked by arm_generate_debug_exceptions()). Breakpoint - * instructions are special because they always generate an exception - * to somewhere: if they can't go to the configured debug exception - * level they are taken to the current exception level. - */ - if (debug_el < cur_el) { - debug_el =3D cur_el; - } - raise_exception(env, EXCP_BKPT, syndrome, debug_el); -} - uint32_t HELPER(cpsr_read)(CPUARMState *env) { return cpsr_read(env) & ~CPSR_EXEC; --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570594; cv=none; d=zohomail.com; s=zohoarc; b=AnccP+4Zf/UAVzmedtG/TK7hP+qT1uXENBtSkxyB88JOkvdLUZuVhS5dxnEvkoDYPDPBDzIpiTpW+pCjMp9qOijzeKOCswIOc3TvVM+Zl5VCtk/6fZ2Wuw1TjtbsgFx6nBtuCsMQyvf0EeONxR/cnivH3Ttx4/322VvSqWhHhvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570594; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bgbyv0kyxTzSSLAbU+4HIoEqn6rfGQtEpi8WGE77FZs=; b=F47g7c0BOdSwx9SfQKLA2hr+79L/w2TWBu3SR6vBdK2K5OrsWLG3rxCSwKYTfS3pzQOagHWdjJ33emws7PG0CIV0rHOla3KLJDDNzcELL0ztBXgLzHnHVxGn2kKOzpir2Ee9xhMd/HK/VUM79fyHnfP6q5kWzyGJoWjiOebWgtU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165457059423486.95018926060857; Mon, 6 Jun 2022 19:56:34 -0700 (PDT) Received: from localhost ([::1]:46434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPOS-0005XZ-R5 for importer@patchew.org; Mon, 06 Jun 2022 22:56:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG1-0006qK-94 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:49 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:44864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFw-0000Js-Gb for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:47 -0400 Received: by mail-pl1-x634.google.com with SMTP id h1so13640587plf.11 for ; Mon, 06 Jun 2022 19:47:44 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:42 -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=bgbyv0kyxTzSSLAbU+4HIoEqn6rfGQtEpi8WGE77FZs=; b=heDhTZTPnv8QLs0MU9ihiZcWMCnwPLs1DaSLcfdJ8nSu+8mA6Q1e2eZUWHb9AmGda5 wGhtMMHIY8RuSY/woxO6ZPS3ON5yWdTujvVZvU4RweaKQv2opXg9npwjtjRaGJqVYZOh xD/Cqm3Bv7WpzGHYHMJys/R32zfmKFLp7KglKwqDWb4sgdiIu5ClfBHCnbsFjUG+26Hh C9awXfwjQ6KyQOQKxYQ6urye+32ekxNiNlW3HXLqNKKH+ynP0bg4JgjLKW1OTlm7LY37 Q9aIxCsdbZpjCflzjaXhuI/1IofwWTEZMze9JDfduqKGsaaFrdl+5VpOUXfLn1ngDWHX uJNQ== 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=bgbyv0kyxTzSSLAbU+4HIoEqn6rfGQtEpi8WGE77FZs=; b=YnqwZYnrDWHtWXKLEJwOrC65NjKimhvNQ4xN/sx0cs6MzbBITtTa6jeTMhKjj2dMtd Gs9JNbwaOtwp4OGwov6oKCjYdIXaTZo4XBZzfKcKB6Egrlo3127aUbvl3+FTYxdxg39d 5N67wU6Ma1tc5d7L9DeRsMbJjVejUz1VJErKS/vs6Yclzyz2+9Fzx8DlxWexGaFjgKqZ gXYkoM3LARQyhx3WSGC+Y/cujVOi1QwJGqzJMo9/vHspxQSA/wgStfRbH7K9Po1cuowp tbdS+caxO+ftFPeiOkiflYjx9W+nLe+IgTWb/6SrE+X4cGNEUgkqWRDBT1Dt+9eJjVgF t7eA== X-Gm-Message-State: AOAM533nf1e3g+kp4B4UWEZ8vAbg7lB32pWKbs9A7t+41G8/2eNnPell Ums5cmAVhntu+aTiCGPpWyg7gpjS5OFfBg== X-Google-Smtp-Source: ABdhPJxY2jVioKkvZn6G54Gve7UxJmTaIFrPUP1bZtLIYi+n4NijzCJgej2Ekuu5FkC7tIh4IqZnGQ== X-Received: by 2002:a17:90a:5c84:b0:1dc:9b42:f2cf with SMTP id r4-20020a17090a5c8400b001dc9b42f2cfmr64404390pji.123.1654570063132; Mon, 06 Jun 2022 19:47:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 09/25] target/arm: Move arm_debug_exception_fsr to debug_helper.c Date: Mon, 6 Jun 2022 19:47:18 -0700 Message-Id: <20220607024734.541321-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570594668100001 Content-Type: text/plain; charset="utf-8" This function now now only used in debug_helper.c, so there is no reason to have a declaration in a header. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/internals.h | 25 ------------------------- target/arm/debug_helper.c | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index e9ac54f244..c8410ee801 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -793,31 +793,6 @@ static inline TCR *regime_tcr(CPUARMState *env, ARMMMU= Idx mmu_idx) return &env->cp15.tcr_el[regime_el(env, mmu_idx)]; } =20 -/* Return the FSR value for a debug exception (watchpoint, hardware - * breakpoint or BKPT insn) targeting the specified exception level. - */ -static inline uint32_t arm_debug_exception_fsr(CPUARMState *env) -{ - ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Debug }; - int target_el =3D arm_debug_target_el(env); - bool using_lpae =3D false; - - if (target_el =3D=3D 2 || arm_el_is_aa64(env, target_el)) { - using_lpae =3D true; - } else { - if (arm_feature(env, ARM_FEATURE_LPAE) && - (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { - using_lpae =3D true; - } - } - - if (using_lpae) { - return arm_fi_to_lfsc(&fi); - } else { - return arm_fi_to_sfsc(&fi); - } -} - /** * arm_num_brps: Return number of implemented breakpoints. * Note that the ID register BRPS field is "number of bps - 1", diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 80dff0788b..a743061e89 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -379,6 +379,32 @@ bool arm_debug_check_watchpoint(CPUState *cs, CPUWatch= point *wp) return check_watchpoints(cpu); } =20 +/* + * Return the FSR value for a debug exception (watchpoint, hardware + * breakpoint or BKPT insn) targeting the specified exception level. + */ +static uint32_t arm_debug_exception_fsr(CPUARMState *env) +{ + ARMMMUFaultInfo fi =3D { .type =3D ARMFault_Debug }; + int target_el =3D arm_debug_target_el(env); + bool using_lpae =3D false; + + if (target_el =3D=3D 2 || arm_el_is_aa64(env, target_el)) { + using_lpae =3D true; + } else { + if (arm_feature(env, ARM_FEATURE_LPAE) && + (env->cp15.tcr_el[target_el].raw_tcr & TTBCR_EAE)) { + using_lpae =3D true; + } + } + + if (using_lpae) { + return arm_fi_to_lfsc(&fi); + } else { + return arm_fi_to_sfsc(&fi); + } +} + void arm_debug_excp_handler(CPUState *cs) { /* --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570854; cv=none; d=zohomail.com; s=zohoarc; b=ViWoja0Cr1fs6uwZB6P+WTdKaOXgOmLuiHRgcBkubM5upTjKsfqhUsP+AxQDb9TF0sTwBl0hyMDSFOOPs0IuTSEkv14YgSYhU+wwXp4UtUDG4ONPDG6HmjRtJbUBBwodYMev9TL9KT8Etff5SkwqjQn5bDBT1ZCFaBC9jjV90g0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570854; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9S8DgVIYwXT3v7+Mq8zUaV8sSMq5mSYLW1DSinvTJ/c=; b=mtJ35fcbKTNrc+aiTqfpm4JrSOvMFtvOBemwVhacge/RHotQFVhr6PJ80IVS/vJkAMNG4xEK7/OoQS/tT/xVa7j8jUzbLlBlZjQmY3s/mRUVNudue5bsT8Tt6gLgijqRXu73JTGOc/ZhBLfH6iLuqJBMI8ODfX6Jfxc7XYJukFk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570854314967.9938489785619; Mon, 6 Jun 2022 20:00:54 -0700 (PDT) Received: from localhost ([::1]:59306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPSf-0005pW-7P for importer@patchew.org; Mon, 06 Jun 2022 23:00:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG1-0006sa-Jl for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:49 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:44647) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFx-0000K8-3K for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:48 -0400 Received: by mail-pg1-x536.google.com with SMTP id c18so6218460pgh.11 for ; Mon, 06 Jun 2022 19:47:44 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:43 -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=9S8DgVIYwXT3v7+Mq8zUaV8sSMq5mSYLW1DSinvTJ/c=; b=S91Jd+1otx21UGN8wuqGFzTijKyO8JHYnyjyvh74paoeE4Zd6lHITfxFmz+qgcttMF nqEQ8no8oEi2BVGSigpoRXum+peB3TiuVHweWQSnGpMRGmat25uPxgMrIPt1L80v7PbW g5WEnxyWWbO8koAnSUo0+qGM9dXHw+mTJtZ+x7egbBxuFuMmVfFSacNR+KZki8WnmTzp TUv5gdhfxce04sHUmBR9WPr4PcJLyIZKWvV/qHG6P6bjvZAij6IQ43iD8DaAMKaazFXo 5waFt5KDVVnvXp6KUfW7hOgugJhsGL0cCY2O/reRopw0H0A6Ro0YQWXAwJW1xnqYuthr fcmA== 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=9S8DgVIYwXT3v7+Mq8zUaV8sSMq5mSYLW1DSinvTJ/c=; b=2TZTLr+WbcdvRa8HQ2F/tvXKhWdrntcI1KI0tVL78o4cC6rmiBuZgpwaL/zHahBLH2 MS2WJjXm5T9LLGradsAdk5NdQMCE87Zl9pqFuGyhN++XKrBSWOuUloxlCDdinm88hppA T0iL+NvE/PYjqrDWtI47KK5nA3fH/TqzmuGOQjCLxid6OOH5ZwcQNorKPxi7NUKSD8Lf h8gptIk7laGzHfnoD+3RrmRMrqaN7pTiZW2q++Jz45nwg2RNhYqvsdkCIqaRCmV5YLYt XDNCyt2hJ4iKx8zF2HX3hnjJJO13jT6oMvl2MTgleMuKJ5PxlimMqrZ7YCwt9S9l5d3T vKsw== X-Gm-Message-State: AOAM533PCDhUhSHRxFlBMRiBWC51+b6dM/gU5Ta2tpW3NLrv6bYjciO5 AEjQyVK2C392vEWoS/ig2hsh2sC+5XWBjA== X-Google-Smtp-Source: ABdhPJw06Z+DMT6ql2VsTqvHrQsrLPOOw5tKhnCQiF47mPG4Wsh8LCWAUvWXDT9U88OSZlbEHcDD6g== X-Received: by 2002:a05:6a00:1496:b0:51b:dfb2:c9b5 with SMTP id v22-20020a056a00149600b0051bdfb2c9b5mr21161067pfu.84.1654570063803; Mon, 06 Jun 2022 19:47:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 10/25] target/arm: Rename helper_exception_with_syndrome Date: Mon, 6 Jun 2022 19:47:19 -0700 Message-Id: <20220607024734.541321-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x536.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570855751100001 Content-Type: text/plain; charset="utf-8" Rename to helper_exception_with_syndrome_el, to emphasize that the target el is a parameter. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 2 +- target/arm/translate.h | 6 +++--- target/arm/op_helper.c | 6 +++--- target/arm/translate.c | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index a13007699d..aca86612b4 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -45,7 +45,7 @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i= 32) DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_2(exception_internal, noreturn, env, i32) -DEF_HELPER_4(exception_with_syndrome, noreturn, env, i32, i32, i32) +DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32) DEF_HELPER_3(exception_advsimdfp_access, noreturn, env, i32, i32) DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) diff --git a/target/arm/translate.h b/target/arm/translate.h index da5f89d49d..1d6a8c7dca 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -332,9 +332,9 @@ static inline void gen_ss_advance(DisasContext *s) static inline void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) { - gen_helper_exception_with_syndrome(cpu_env, tcg_constant_i32(excp), - tcg_constant_i32(syndrome), - tcg_constant_i32(target_el)); + gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), + tcg_constant_i32(syndrome), + tcg_constant_i32(target_el)); } =20 static inline void gen_exception_advsimdfp_access(DisasContext *s, diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index ae0009d1a3..1c4e6753f6 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -373,7 +373,7 @@ void HELPER(yield)(CPUARMState *env) * those EXCP values which are special cases for QEMU to interrupt * execution and not to be used for exceptions which are passed to * the guest (those must all have syndrome information and thus should - * use exception_with_syndrome). + * use exception_with_syndrome*). */ void HELPER(exception_internal)(CPUARMState *env, uint32_t excp) { @@ -385,8 +385,8 @@ void HELPER(exception_internal)(CPUARMState *env, uint3= 2_t excp) } =20 /* Raise an exception with the specified syndrome register value */ -void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, - uint32_t syndrome, uint32_t target_el) +void HELPER(exception_with_syndrome_el)(CPUARMState *env, uint32_t excp, + uint32_t syndrome, uint32_t target= _el) { raise_exception(env, excp, syndrome, target_el); } diff --git a/target/arm/translate.c b/target/arm/translate.c index 87a899d638..dc033600c0 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1119,9 +1119,9 @@ static void gen_exception_el(DisasContext *s, int exc= p, uint32_t syn, { gen_set_condexec(s); gen_set_pc_im(s, s->pc_curr); - gen_helper_exception_with_syndrome(cpu_env, - tcg_constant_i32(excp), - tcg_constant_i32(syn), tcg_el); + gen_helper_exception_with_syndrome_el(cpu_env, + tcg_constant_i32(excp), + tcg_constant_i32(syn), tcg_el); s->base.is_jmp =3D DISAS_NORETURN; } =20 --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570770; cv=none; d=zohomail.com; s=zohoarc; b=hlVmZlkme3iR5XApo1BJV0QYJPpnXxWB0B1FrdwR4QIqSIASTyUCRjGXhV4DUkwaWaJAHd8cdlzhBsJNWx7zC+uIUB/pk8q5Rzb2QFJa7dmAr4X1TQQUmCx4ER6UG91ucYzoIF4bJ3xc2O/yguHQ2Te8SG1JmQG5cQ6EOWd1qdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570770; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=289sSy4/34uhXPS50aA0Z7O/jFOKdwauFBDFQW9kqgA=; b=keWz9dqBs3L9eDqqb8d4PQypTCJdLezJX9HaiHPuE8mD3TFa2kCBe00rdiZgZswfZhshpdpBwU1x9GPsIJyqJ6cftdR8dRSjTCCiOVyE7hZqaLnsmq46fqqnOGmVXtTNk6PTEmLOAq0Pvt3KX0qM8fCyBtpYltobxzqufWFMUw4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570770447630.5774378857793; Mon, 6 Jun 2022 19:59:30 -0700 (PDT) Received: from localhost ([::1]:56010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPRJ-0003cO-9D for importer@patchew.org; Mon, 06 Jun 2022 22:59:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG1-0006tr-TC for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:49 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:43725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFx-0000KV-VG for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:49 -0400 Received: by mail-pg1-x530.google.com with SMTP id s68so14539452pgs.10 for ; Mon, 06 Jun 2022 19:47:45 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:44 -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=289sSy4/34uhXPS50aA0Z7O/jFOKdwauFBDFQW9kqgA=; b=DYg/ZaQrnmiCUvWZk177IA9o8P3kahZ3zUq1QRY1Xk/pi0cDPTLqzGpHET2iTpTKoY MVfw/CG05eTaOvUs5gV32bvrcTY6gaepTYrQG7eNo8ByLRjS3lEqswZBcowrSGn4snss 61yy7g3CZo6eJR1vrejD3AqudCG1WsEVSDHHLqNETUB8qZFUmy+Ir624fGNkJGdrbWQj bOC8+RHKS/+iwKc/t2Ms8kln5sr6PYkQCcVLh1iG9WxWvDw6S03Q/NYSIE7pbdmh/NdK 67J1M3GRQ79oibveZ8l5IFmz+f5pXdT3ApaJ/tmz6/qSxquWTiz+gHVhA3IE8RgAoQHA 5ocQ== 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=289sSy4/34uhXPS50aA0Z7O/jFOKdwauFBDFQW9kqgA=; b=nzhxksUyA31JGPCP04FyHf7AabBOqhp46oyBN/cnUh/YF5tavs6nXRr+SPcZdgBEd7 u9MkYBm9s9n2qBJSpMNrPC5bS3FKfPTArlrKmkjBHMqvBuMY/tJmTlhBzJBzmiFZYGOg G7lLGyy7EiUWPonJzZCJxt82kuJ66A8wUpiukzx2TtXvs1jOEn+vjTiBXwRW9K1D6a4O RYmAS6AG2psbuZOvS5XJLoui7rwQtlHHqBm+04Eu9yRxoMqJrfVK1o8tThTJjpKSjV3W I+0+p4SeRQtiEhiB0TkRL/tVYzwsIbeBX2PlWvsRSyi58sL31rUWeXjYRK11/XEj2Y0T 1UOg== X-Gm-Message-State: AOAM533svHkWyAawvo3RI1UHjkZK4ug3ZpUHJxCfJUJudULo1Bs4n0FN A6h91KVVa963nw4XICf4/CZit7BzuizFTQ== X-Google-Smtp-Source: ABdhPJz95OEFkBOlABs4Aqa2KvfcPEMabJAIdO+PtnNcwNfAJp8rd5tb0UGP1e6TwAwaI5m0FKQXzQ== X-Received: by 2002:a05:6a00:170c:b0:51b:f057:85c2 with SMTP id h12-20020a056a00170c00b0051bf05785c2mr16600952pfc.18.1654570064617; Mon, 06 Jun 2022 19:47:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 11/25] target/arm: Introduce gen_exception_insn_el_v Date: Mon, 6 Jun 2022 19:47:20 -0700 Message-Id: <20220607024734.541321-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570771252100001 Content-Type: text/plain; charset="utf-8" Create a function below gen_exception_insn that takes the target_el as a TCGv_i32, replacing gen_exception_el. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index dc033600c0..9cb31663dd 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1086,8 +1086,8 @@ static void gen_exception_internal_insn(DisasContext = *s, uint32_t pc, int excp) s->base.is_jmp =3D DISAS_NORETURN; } =20 -void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, - uint32_t syn, uint32_t target_el) +static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp, + uint32_t syn, TCGv_i32 tcg_el) { if (s->aarch64) { gen_a64_set_pc_im(pc); @@ -1095,10 +1095,17 @@ void gen_exception_insn(DisasContext *s, uint64_t p= c, int excp, gen_set_condexec(s); gen_set_pc_im(s, pc); } - gen_exception(excp, syn, target_el); + gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), + tcg_constant_i32(syn), tcg_el); s->base.is_jmp =3D DISAS_NORETURN; } =20 +void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, + uint32_t syn, uint32_t target_el) +{ + gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el)); +} + static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) { gen_set_condexec(s); @@ -1114,17 +1121,6 @@ void unallocated_encoding(DisasContext *s) default_exception_el(s)); } =20 -static void gen_exception_el(DisasContext *s, int excp, uint32_t syn, - TCGv_i32 tcg_el) -{ - gen_set_condexec(s); - gen_set_pc_im(s, s->pc_curr); - gen_helper_exception_with_syndrome_el(cpu_env, - tcg_constant_i32(excp), - tcg_constant_i32(syn), tcg_el); - s->base.is_jmp =3D DISAS_NORETURN; -} - /* Force a TB lookup after an instruction that changes the CPU state. */ void gen_lookup_tb(DisasContext *s) { @@ -2847,7 +2843,8 @@ static bool msr_banked_access_decode(DisasContext *s,= int r, int sysm, int rn, tcg_el =3D tcg_constant_i32(3); } =20 - gen_exception_el(s, EXCP_UDEF, syn_uncategorized(), tcg_el); + gen_exception_insn_el_v(s, s->pc_curr, EXCP_UDEF, + syn_uncategorized(), tcg_el); tcg_temp_free_i32(tcg_el); return false; } --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571080; cv=none; d=zohomail.com; s=zohoarc; b=f91izHaLVEVSEFoZqfvLVfwPbDxFDQcQOLbbd/JmhkbR4+oW1y95mq8+MHd4aIQXr8EawFdqu+3WNCPnGXKAIr7/ucM/xf0RXJvjV4wTl6uw3VI25xvnZxKn9RlarcXAPog6MgebmCwtyt+p3NxBJ7SrjnniAxh1z9KO/bQd7SE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571080; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S+xsC7lZ+/OAT5GsLdjM1Piovvny0mMzGC3UEnlB6jo=; b=U8HYv/RYRhZATYzJeHxdVjjJJcRcfPcR3DXdnS2R96EeUWDAiKTbg+ShptifPdRI0Lpg5ddH1AizoPDwE5cPC7ii72lJ6ngpbuBZuQWQDCWQJ316qZUdrnBJz8djt9yKMyfqoejtyfenebg9/7mnWS452XUuD31uNbz8Ih84nIY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571080001589.9710179845523; Mon, 6 Jun 2022 20:04:40 -0700 (PDT) Received: from localhost ([::1]:36336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPWI-00016d-V9 for importer@patchew.org; Mon, 06 Jun 2022 23:04:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG3-0006zU-Lz for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:51 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:36380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFy-0000Kx-Oj for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:51 -0400 Received: by mail-pj1-x1032.google.com with SMTP id u12-20020a17090a1d4c00b001df78c7c209so19564229pju.1 for ; Mon, 06 Jun 2022 19:47:46 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:45 -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=S+xsC7lZ+/OAT5GsLdjM1Piovvny0mMzGC3UEnlB6jo=; b=r/ftB78bvqVPGpUaUzTQ/fJll/HNBotA/Z46Lj8tMGRQOmQUUkevBwdkiHY/u5+XMj YZDPPmM5blKIvNlE1KIrZOlellwrLyX4vu651dJCdqnmqxovOnX4ObRB96AzO19tCtqf H+F9ZQ7gFvtmYrKxP5OSZrXiKn7ogasNyt/zs9L3vjt+qBLmXbAAia5ABLyfPPBHibqn +K/T9pukHgTmZfcsxF6DZuGyFtcHdfKwyhiat6hyAh0IrKKvO5UZm6mNrxGeCW+8CCP2 yVPzXxEcot3wQCxOeH8ShcUXzy2Nd1gNwzt0z7Ls23VEwYbszVm0siAL7m5CmrmOXeE4 AIyQ== 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=S+xsC7lZ+/OAT5GsLdjM1Piovvny0mMzGC3UEnlB6jo=; b=AoljBkFRkg9u+EsJTFjYPv6EjIb85+4iq0BwokRp7FXYYENOGSKAFzGHumsOY9zrBe gVpmwAEdI3Is/OI1hVKLWDXqUpz202IcW3MxOHC9PWrugIGyv+R5/aaA9l7lS4JaeC1c doHx0r1a34xjXC49wuhKmhKrot2p6cjiPNlzT2im1VDdXnL2laAd3ciPSBJ1k03CyMwB etU22Kl8qghnFEaG+J5A4CAldbFA6PADd7fuumB0PUX81i8NCbvdiKly+LHII4T9u2PF n2+/kBtvwiYu2v8Opl/JhPtRaj4m9dS37Lho0IWwhKqoJi0Lpn12/L7/mkFwZfCUPtlW eD5Q== X-Gm-Message-State: AOAM533GZJTeJTvQC6UhmNF57TeJe847UfWHfgoctqOmn3DZJlQUCZ3u LUkIUS/GBUXwFDsVB9nUPI61q9UUEMO8KQ== X-Google-Smtp-Source: ABdhPJxoooSWtU+ElGcz0vpiL/WNzNtP5b3YJWC/kQvA0zmxlgndlD9heoMKzTisVADkAVTun0HT7A== X-Received: by 2002:a17:90b:1a8f:b0:1e8:7dfe:c4f with SMTP id ng15-20020a17090b1a8f00b001e87dfe0c4fmr9693040pjb.17.1654570065487; Mon, 06 Jun 2022 19:47:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 12/25] target/arm: Rename gen_exception_insn to gen_exception_insn_el Date: Mon, 6 Jun 2022 19:47:21 -0700 Message-Id: <20220607024734.541321-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571080866100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.h | 4 ++-- target/arm/translate-a64.c | 30 +++++++++++++-------------- target/arm/translate-m-nocp.c | 16 +++++++------- target/arm/translate-mve.c | 4 ++-- target/arm/translate-vfp.c | 4 ++-- target/arm/translate.c | 39 ++++++++++++++++++----------------- 6 files changed, 49 insertions(+), 48 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 1d6a8c7dca..c54db51d70 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -279,8 +279,8 @@ void arm_jump_cc(DisasCompare *cmp, TCGLabel *label); void arm_gen_test_cc(int cc, TCGLabel *label); MemOp pow2_align(unsigned i); void unallocated_encoding(DisasContext *s); -void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, - uint32_t syn, uint32_t target_el); +void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp, + uint32_t syn, uint32_t target_el); =20 /* Return state of Alternate Half-precision flag, caller frees result */ static inline TCGv_i32 get_ahp_flag(void) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 3251c69180..cc96535fae 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1178,8 +1178,8 @@ bool sve_access_check(DisasContext *s) assert(!s->sve_access_checked); s->sve_access_checked =3D true; =20 - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_sve_access_trap(), s->sve_excp_el); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_sve_access_trap(), s->sve_excp_el); return false; } s->sve_access_checked =3D true; @@ -1815,8 +1815,8 @@ static void gen_sysreg_undef(DisasContext *s, bool is= read, } else { syndrome =3D syn_uncategorized(); } - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syndrome, - default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syndrome, + default_exception_el(s)); } =20 /* MRS - move from system register @@ -2068,8 +2068,8 @@ static void disas_exc(DisasContext *s, uint32_t insn) switch (op2_ll) { case 1: /* SVC= */ gen_ss_advance(s); - gen_exception_insn(s, s->base.pc_next, EXCP_SWI, - syn_aa64_svc(imm16), default_exception_el(s= )); + gen_exception_insn_el(s, s->base.pc_next, EXCP_SWI, + syn_aa64_svc(imm16), default_exception_e= l(s)); break; case 2: /* HVC= */ if (s->current_el =3D=3D 0) { @@ -2082,8 +2082,8 @@ static void disas_exc(DisasContext *s, uint32_t insn) gen_a64_set_pc_im(s->pc_curr); gen_helper_pre_hvc(cpu_env); gen_ss_advance(s); - gen_exception_insn(s, s->base.pc_next, EXCP_HVC, - syn_aa64_hvc(imm16), 2); + gen_exception_insn_el(s, s->base.pc_next, EXCP_HVC, + syn_aa64_hvc(imm16), 2); break; case 3: /* SMC= */ if (s->current_el =3D=3D 0) { @@ -2093,8 +2093,8 @@ static void disas_exc(DisasContext *s, uint32_t insn) gen_a64_set_pc_im(s->pc_curr); gen_helper_pre_smc(cpu_env, tcg_constant_i32(syn_aa64_smc(imm1= 6))); gen_ss_advance(s); - gen_exception_insn(s, s->base.pc_next, EXCP_SMC, - syn_aa64_smc(imm16), 3); + gen_exception_insn_el(s, s->base.pc_next, EXCP_SMC, + syn_aa64_smc(imm16), 3); break; default: unallocated_encoding(s); @@ -14724,8 +14724,8 @@ static void aarch64_tr_translate_insn(DisasContextB= ase *dcbase, CPUState *cpu) * Illegal execution state. This has priority over BTI * exceptions, but comes after instruction abort exceptions. */ - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_illegalstate(), default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_illegalstate(), default_exception_el(s)); return; } =20 @@ -14756,9 +14756,9 @@ static void aarch64_tr_translate_insn(DisasContextB= ase *dcbase, CPUState *cpu) if (s->btype !=3D 0 && s->guarded_page && !btype_destination_ok(insn, s->bt, s->btype)) { - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_btitrap(s->btype), - default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_btitrap(s->btype), + default_exception_el(s)); return; } } else { diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c index 27363a7b4e..636bfb1788 100644 --- a/target/arm/translate-m-nocp.c +++ b/target/arm/translate-m-nocp.c @@ -143,8 +143,8 @@ static bool trans_VSCCLRM(DisasContext *s, arg_VSCCLRM = *a) tcg_gen_brcondi_i32(TCG_COND_EQ, sfpa, 0, s->condlabel); =20 if (s->fp_excp_el !=3D 0) { - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, - syn_uncategorized(), s->fp_excp_el); + gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP, + syn_uncategorized(), s->fp_excp_el); return true; } =20 @@ -376,7 +376,7 @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int = regno, if (!vfp_access_check_m(s, true)) { /* * This was only a conditional exception, so override - * gen_exception_insn()'s default to DISAS_NORETURN + * gen_exception_insn_el()'s default to DISAS_NORETURN */ s->base.is_jmp =3D DISAS_NEXT; break; @@ -532,7 +532,7 @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int r= egno, if (!vfp_access_check_m(s, true)) { /* * This was only a conditional exception, so override - * gen_exception_insn()'s default to DISAS_NORETURN + * gen_exception_insn_el()'s default to DISAS_NORETURN */ s->base.is_jmp =3D DISAS_NEXT; break; @@ -765,14 +765,14 @@ static bool trans_NOCP(DisasContext *s, arg_nocp *a) } =20 if (a->cp !=3D 10) { - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, - syn_uncategorized(), default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP, + syn_uncategorized(), default_exception_el(s)= ); return true; } =20 if (s->fp_excp_el !=3D 0) { - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, - syn_uncategorized(), s->fp_excp_el); + gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP, + syn_uncategorized(), s->fp_excp_el); return true; } =20 diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 4267d43cc7..5aec2a1555 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -100,8 +100,8 @@ bool mve_eci_check(DisasContext *s) return true; default: /* Reserved value: INVSTATE UsageFault */ - gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized= (), - default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategori= zed(), + default_exception_el(s)); return false; } } diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 2a98387411..f939d64101 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -262,8 +262,8 @@ bool vfp_access_check_m(DisasContext *s, bool skip_cont= ext_update) * the encoding space handled by the patterns in m-nocp.decode, * and for them we may need to raise NOCP here. */ - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, - syn_uncategorized(), s->fp_excp_el); + gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP, + syn_uncategorized(), s->fp_excp_el); return false; } =20 diff --git a/target/arm/translate.c b/target/arm/translate.c index 9cb31663dd..44f462a3a3 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1100,8 +1100,8 @@ static void gen_exception_insn_el_v(DisasContext *s, = uint64_t pc, int excp, s->base.is_jmp =3D DISAS_NORETURN; } =20 -void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, - uint32_t syn, uint32_t target_el) +void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp, + uint32_t syn, uint32_t target_el) { gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el)); } @@ -1117,8 +1117,8 @@ static void gen_exception_bkpt_insn(DisasContext *s, = uint32_t syn) void unallocated_encoding(DisasContext *s) { /* Unallocated and reserved encodings are uncategorized */ - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), - default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), + default_exception_el(s)); } =20 /* Force a TB lookup after an instruction that changes the CPU state. */ @@ -2869,8 +2869,8 @@ static bool msr_banked_access_decode(DisasContext *s,= int r, int sysm, int rn, =20 undef: /* If we get here then some access check did not pass */ - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_uncategorized(), exc_target); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_uncategorized(), exc_target); return false; } =20 @@ -5094,7 +5094,8 @@ static void gen_srs(DisasContext *s, * For the UNPREDICTABLE cases we choose to UNDEF. */ if (s->current_el =3D=3D 1 && !s->ns && mode =3D=3D ARM_CPU_MODE_MON) { - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), = 3); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_uncategorized(), 3); return; } =20 @@ -8479,8 +8480,8 @@ static bool trans_WLS(DisasContext *s, arg_WLS *a) * Do the check-and-raise-exception by hand. */ if (s->fp_excp_el) { - gen_exception_insn(s, s->pc_curr, EXCP_NOCP, - syn_uncategorized(), s->fp_excp_el); + gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP, + syn_uncategorized(), s->fp_excp_el); return true; } } @@ -8582,8 +8583,8 @@ static bool trans_LE(DisasContext *s, arg_LE *a) tmp =3D load_cpu_field(v7m.ltpsize); tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 4, skipexc); tcg_temp_free_i32(tmp); - gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized= (), - default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategori= zed(), + default_exception_el(s)); gen_set_label(skipexc); } =20 @@ -9053,8 +9054,8 @@ static void disas_arm_insn(DisasContext *s, unsigned = int insn) * UsageFault exception. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { - gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized= (), - default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategori= zed(), + default_exception_el(s)); return; } =20 @@ -9063,8 +9064,8 @@ static void disas_arm_insn(DisasContext *s, unsigned = int insn) * Illegal execution state. This has priority over BTI * exceptions, but comes after instruction abort exceptions. */ - gen_exception_insn(s, s->pc_curr, EXCP_UDEF, - syn_illegalstate(), default_exception_el(s)); + gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_illegalstate(), default_exception_el(s)); return; } =20 @@ -9633,8 +9634,8 @@ static void thumb_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) * Illegal execution state. This has priority over BTI * exceptions, but comes after instruction abort exceptions. */ - gen_exception_insn(dc, dc->pc_curr, EXCP_UDEF, - syn_illegalstate(), default_exception_el(dc)); + gen_exception_insn_el(dc, dc->pc_curr, EXCP_UDEF, + syn_illegalstate(), default_exception_el(dc)= ); return; } =20 @@ -9707,8 +9708,8 @@ static void thumb_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) */ tcg_remove_ops_after(dc->insn_eci_rewind); dc->condjmp =3D 0; - gen_exception_insn(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncategoriz= ed(), - default_exception_el(dc)); + gen_exception_insn_el(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncatego= rized(), + default_exception_el(dc)); } =20 arm_post_translate_insn(dc); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571187; cv=none; d=zohomail.com; s=zohoarc; b=ie1fr2pRLoqBBDJL8BuzeOvvMTZ4vcpV3qLazh+84RbEChADoPLQo0j7K2NPRlBXA3aZkN5+Rgfgzgry4R6jg+MdP63k4WUQAexLv5/TxwNhc0J4Oc9S7moQkm+vV57IP6CxtsfStAGSXGcU4VmaD5vTx7QdbwWqeRNYE1I79M8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571187; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SJsPBjgxAIzmv4HQ3HMK84E2HfNlE6G2yY4SYv05x4E=; b=mJZcAATiZIf99KAcCN7tHbZ5ZcDLWnN0P7DRSEpkvlrpjEPFKyjFrwc0JFdQE0bc7QWclw0UJxQ2QNZFl0g+xcxN3CGl3j4WO7kNqs82ujxcD1pyg+XsQBXi0OhrK+l3N7rt5dmC7/mbPOuKhNuCMS1e2j0TsgyQEzkfaD3FgCA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571187586607.375526665006; Mon, 6 Jun 2022 20:06:27 -0700 (PDT) Received: from localhost ([::1]:40040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPY1-0003eJ-SK for importer@patchew.org; Mon, 06 Jun 2022 23:06:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG3-00070O-Sk for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:51 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:36530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPFz-0000LV-U2 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:51 -0400 Received: by mail-pf1-x42b.google.com with SMTP id 15so14288625pfy.3 for ; Mon, 06 Jun 2022 19:47:47 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:46 -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=SJsPBjgxAIzmv4HQ3HMK84E2HfNlE6G2yY4SYv05x4E=; b=b+jR/wV2UICJGjskdupGHqX8deboXE9IGmglenjvTepIYIQ6s3ecfOoTmYZ4z82p6V TgPsjRnoY3LmNmA3GPwdL5mqHgmU8WlwzMvKzYdvxGEpzLaljiEm79zKHyePRTn9TX+6 6vgYM2qxFlcsImrnnN0nOes1RwvQI3n2Az/UwEm6YuZYrOQsSHGL/eF/CuBn6nsGKhAa 2WP9kxGKyCLHEA4oWr9oFbvv2Toso1CecYh9BbQFnqHIc7GX8RpfJGB4dJUv0srGT0hM lnjbjydvdEkS8GMR6uqOz6jBBRRZ2M0b8xnxLHCD0SJL2+lDvnao0nr7LqM1ziYYCD9r Vtwg== 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=SJsPBjgxAIzmv4HQ3HMK84E2HfNlE6G2yY4SYv05x4E=; b=M8R7wZGYMtRW34V6JQg9QZDb9gWEH+iYZGKy0BU4r1HyY6ZcBwS02Sr9FJMR7pbk8G rDTVDq+MJFoo5uz69AzTsToAz2JaNQcP3YFZ2Seftj0dFtw1x6e2RRWnqZcHk+UoG9cy 7idk0GDS804o/hzf7R+PIULOXmwmQ4J3/GbDHDuDE3AATo1RYyXnM0u0BZJxVLkd+wLz tyRwi8sh/ome4CtG6l+5e8iUZMbarzIwMx6ZJBzIGYLIT1IHKOwVI2EtZhgQVnFp7ouB Fc532LC439FIAqMRF/kzFbWwRTPnwsDO9D0qzL1m4gIQj0w3xl3t7nPJ3nlQZNoIrqW3 SE/g== X-Gm-Message-State: AOAM533qSOtfc2FzHvUa3PTiXJpf7/OyajCFYV1wVSpLJ9i+Kt/J61Wu 9UDmNRjKZ5Po82fjGMcqk3GoHnVk4p1Mzg== X-Google-Smtp-Source: ABdhPJwlEvSQ7nXjrT/vESgImwPcwSIkcsiSsDeBDhIUUUBAI9N9rJqabKtDzPcFNlNOxEYWzZSEsg== X-Received: by 2002:a05:6a00:23ce:b0:50d:823f:981 with SMTP id g14-20020a056a0023ce00b0050d823f0981mr27587412pfc.10.1654570066498; Mon, 06 Jun 2022 19:47:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 13/25] target/arm: Introduce gen_exception_insn Date: Mon, 6 Jun 2022 19:47:22 -0700 Message-Id: <20220607024734.541321-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571189418100001 Content-Type: text/plain; charset="utf-8" Create a new wrapper function that passes the default exception target to gen_exception_insn_el. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.h | 1 + target/arm/translate-a64.c | 15 ++++++--------- target/arm/translate-m-nocp.c | 3 +-- target/arm/translate-mve.c | 3 +-- target/arm/translate.c | 29 +++++++++++++---------------- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index c54db51d70..04d45da54e 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -281,6 +281,7 @@ MemOp pow2_align(unsigned i); void unallocated_encoding(DisasContext *s); void gen_exception_insn_el(DisasContext *s, uint64_t pc, int excp, uint32_t syn, uint32_t target_el); +void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t s= yn); =20 /* Return state of Alternate Half-precision flag, caller frees result */ static inline TCGv_i32 get_ahp_flag(void) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index cc96535fae..a5c66ce085 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1815,8 +1815,7 @@ static void gen_sysreg_undef(DisasContext *s, bool is= read, } else { syndrome =3D syn_uncategorized(); } - gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syndrome, - default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syndrome); } =20 /* MRS - move from system register @@ -2068,8 +2067,8 @@ static void disas_exc(DisasContext *s, uint32_t insn) switch (op2_ll) { case 1: /* SVC= */ gen_ss_advance(s); - gen_exception_insn_el(s, s->base.pc_next, EXCP_SWI, - syn_aa64_svc(imm16), default_exception_e= l(s)); + gen_exception_insn(s, s->base.pc_next, EXCP_SWI, + syn_aa64_svc(imm16)); break; case 2: /* HVC= */ if (s->current_el =3D=3D 0) { @@ -14724,8 +14723,7 @@ static void aarch64_tr_translate_insn(DisasContextB= ase *dcbase, CPUState *cpu) * Illegal execution state. This has priority over BTI * exceptions, but comes after instruction abort exceptions. */ - gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, - syn_illegalstate(), default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_illegalstate()); return; } =20 @@ -14756,9 +14754,8 @@ static void aarch64_tr_translate_insn(DisasContextB= ase *dcbase, CPUState *cpu) if (s->btype !=3D 0 && s->guarded_page && !btype_destination_ok(insn, s->bt, s->btype)) { - gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, - syn_btitrap(s->btype), - default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, + syn_btitrap(s->btype)); return; } } else { diff --git a/target/arm/translate-m-nocp.c b/target/arm/translate-m-nocp.c index 636bfb1788..4029d7fdd4 100644 --- a/target/arm/translate-m-nocp.c +++ b/target/arm/translate-m-nocp.c @@ -765,8 +765,7 @@ static bool trans_NOCP(DisasContext *s, arg_nocp *a) } =20 if (a->cp !=3D 10) { - gen_exception_insn_el(s, s->pc_curr, EXCP_NOCP, - syn_uncategorized(), default_exception_el(s)= ); + gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized()); return true; } =20 diff --git a/target/arm/translate-mve.c b/target/arm/translate-mve.c index 5aec2a1555..0cf1b5ea4f 100644 --- a/target/arm/translate-mve.c +++ b/target/arm/translate-mve.c @@ -100,8 +100,7 @@ bool mve_eci_check(DisasContext *s) return true; default: /* Reserved value: INVSTATE UsageFault */ - gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategori= zed(), - default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized= ()); return false; } } diff --git a/target/arm/translate.c b/target/arm/translate.c index 44f462a3a3..c7d422b541 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1106,6 +1106,11 @@ void gen_exception_insn_el(DisasContext *s, uint64_t= pc, int excp, gen_exception_insn_el_v(s, pc, excp, syn, tcg_constant_i32(target_el)); } =20 +void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t s= yn) +{ + gen_exception_insn_el(s, pc, excp, syn, default_exception_el(s)); +} + static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) { gen_set_condexec(s); @@ -1117,8 +1122,7 @@ static void gen_exception_bkpt_insn(DisasContext *s, = uint32_t syn) void unallocated_encoding(DisasContext *s) { /* Unallocated and reserved encodings are uncategorized */ - gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_uncategorized(), - default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized()); } =20 /* Force a TB lookup after an instruction that changes the CPU state. */ @@ -2731,8 +2735,6 @@ static bool msr_banked_access_decode(DisasContext *s,= int r, int sysm, int rn, * an exception and return false. Otherwise it will return true, * and set *tgtmode and *regno appropriately. */ - int exc_target =3D default_exception_el(s); - /* These instructions are present only in ARMv8, or in ARMv7 with the * Virtualization Extensions. */ @@ -2869,8 +2871,7 @@ static bool msr_banked_access_decode(DisasContext *s,= int r, int sysm, int rn, =20 undef: /* If we get here then some access check did not pass */ - gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, - syn_uncategorized(), exc_target); + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_uncategorized()); return false; } =20 @@ -8583,8 +8584,7 @@ static bool trans_LE(DisasContext *s, arg_LE *a) tmp =3D load_cpu_field(v7m.ltpsize); tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, 4, skipexc); tcg_temp_free_i32(tmp); - gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategori= zed(), - default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized= ()); gen_set_label(skipexc); } =20 @@ -9054,8 +9054,7 @@ static void disas_arm_insn(DisasContext *s, unsigned = int insn) * UsageFault exception. */ if (arm_dc_feature(s, ARM_FEATURE_M)) { - gen_exception_insn_el(s, s->pc_curr, EXCP_INVSTATE, syn_uncategori= zed(), - default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_INVSTATE, syn_uncategorized= ()); return; } =20 @@ -9064,8 +9063,7 @@ static void disas_arm_insn(DisasContext *s, unsigned = int insn) * Illegal execution state. This has priority over BTI * exceptions, but comes after instruction abort exceptions. */ - gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, - syn_illegalstate(), default_exception_el(s)); + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, syn_illegalstate()); return; } =20 @@ -9634,8 +9632,7 @@ static void thumb_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) * Illegal execution state. This has priority over BTI * exceptions, but comes after instruction abort exceptions. */ - gen_exception_insn_el(dc, dc->pc_curr, EXCP_UDEF, - syn_illegalstate(), default_exception_el(dc)= ); + gen_exception_insn(dc, dc->pc_curr, EXCP_UDEF, syn_illegalstate()); return; } =20 @@ -9708,8 +9705,8 @@ static void thumb_tr_translate_insn(DisasContextBase = *dcbase, CPUState *cpu) */ tcg_remove_ops_after(dc->insn_eci_rewind); dc->condjmp =3D 0; - gen_exception_insn_el(dc, dc->pc_curr, EXCP_INVSTATE, syn_uncatego= rized(), - default_exception_el(dc)); + gen_exception_insn(dc, dc->pc_curr, EXCP_INVSTATE, + syn_uncategorized()); } =20 arm_post_translate_insn(dc); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570639; cv=none; d=zohomail.com; s=zohoarc; b=d3xJlLTRB/vtHQtlJrjwZ8M3HXMO5ph9sRNkCJD1oUkCYC2ZVZZUB8yVZR66ZxEitOKEw7hwDxZUwe85xJBs6G2odN5UyEHwXZqJ3Bn8YVGMKQPVtCht+E0bOK4g1ye+jFMfMc/qTTAXB0dF9UcHrfgfTDQ9F01+61/nk8NuyUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570639; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aAUg0t4CNRhFnxvoa04tRoC0cuTYTfVxatS7xBTko0w=; b=c2qQGr7P/CL2JhA1CC1OinwcOaOvqCHmzXVr7kw/a8V1OBeobVj5aHHPiZmKI7RHcZ+LQfQGma26rjGaUpfldQEFAbLCM/CICpkFI/pFoXzPb5L1O3O1o+jcwnD9rmfxhisnwcR4IDMu3laQKlUyK9AGqpOd0zoii5CM+HHhBDg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16545706391071017.5179071177349; Mon, 6 Jun 2022 19:57:19 -0700 (PDT) Received: from localhost ([::1]:49134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPP9-0007Py-VR for importer@patchew.org; Mon, 06 Jun 2022 22:57:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG5-00075Q-9h for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:53 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:41836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG1-0000Ln-W3 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:52 -0400 Received: by mail-pj1-x102b.google.com with SMTP id l20-20020a17090a409400b001dd2a9d555bso14238434pjg.0 for ; Mon, 06 Jun 2022 19:47:48 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:46 -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=aAUg0t4CNRhFnxvoa04tRoC0cuTYTfVxatS7xBTko0w=; b=sa0KsQxpiX6Q66nJM1M1NhHyMQzTSzoW/PNj7sjW7FiZCZYM+g+s6OYqpgMGxs6RiM 4uUe0xmHnYoqAL46oo3AicG9aaGItpmJmZDAwNTj7L3gGLa5HBmme5TJvNJN04R92lWJ lUsYlS4/+1QG4lY/xgTVR4QWIEsvvAhBQ74WGUxTakP0TT6BmyflRzGt074iivPmkyCt cB3FSLDk8bDdGolgr2zrE8XGKlqU/JLnQ0d+rBSBLSDpVhfr8kVrt5irK4DHbIWHJg51 SwwHoNeqhjPuXoL5izlLJdm7maSdy0nNax80Ei5uy7/uHh/Uts0d7yuy+EjcoumtYKn6 Kpug== 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=aAUg0t4CNRhFnxvoa04tRoC0cuTYTfVxatS7xBTko0w=; b=K9f7IusX9w48Sl1aT6oMseE2Bex8t3LgJ4pcQeZPIbNQSH3hVNgLQnWkdsGAKMvaML t+EHfjLpIdlDqHC4BhDwU4cztELvfFs+qwl+jp0JHEAgc4k8gS9v+u2PGMOw/cAKhQ3A XG80CMtFsDvv/a8ekXTzDBFeoKguwe3l5lPF1mjbw/xrthXAGZHky8jpYJKCoDr8o4Zk wcHVl/beOILleNHZEezjpjP1SNa2wsMOe7ALVJQJl7BGuupZDuUiqjfrkMte7m/1n3ad RQNYe01hqyQmy+2WBdCnf2ula6iJV2s6j+Mg9Wsg+hWR6nL7bCRfUOA14Niykih3fnuw chbw== X-Gm-Message-State: AOAM531Q7ntdo5gBnPQ/yRl7nk3vlohOXbhPUQHCyex4b2CnnN/pkmQt XFl2QDjjJT+W55DQaW+d4gUtrWi1QNZW0A== X-Google-Smtp-Source: ABdhPJxDZ6oXT/AqlQXEJzHh0zb+kzOHCAgpRzkc4mAgpWlvi6mHHVJgrl38a8n6nujkmMqtFaADww== X-Received: by 2002:a17:902:d4c2:b0:166:46c9:577b with SMTP id o2-20020a170902d4c200b0016646c9577bmr23581425plg.66.1654570067488; Mon, 06 Jun 2022 19:47:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 14/25] target/arm: Create helper_exception_swstep Date: Mon, 6 Jun 2022 19:47:23 -0700 Message-Id: <20220607024734.541321-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570640732100001 Content-Type: text/plain; charset="utf-8" Move the computation from gen_swstep_exception into a helper. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 1 + target/arm/translate.h | 12 +++--------- target/arm/debug_helper.c | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index aca86612b4..afc0f1a462 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -48,6 +48,7 @@ DEF_HELPER_2(exception_internal, noreturn, env, i32) DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32) DEF_HELPER_3(exception_advsimdfp_access, noreturn, env, i32, i32) DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) +DEF_HELPER_2(exception_swstep, noreturn, env, i32) DEF_HELPER_2(exception_pc_alignment, noreturn, env, tl) DEF_HELPER_1(setend, void, env) DEF_HELPER_2(wfi, void, env, i32) diff --git a/target/arm/translate.h b/target/arm/translate.h index 04d45da54e..c720a7e26c 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -350,15 +350,9 @@ static inline void gen_exception_advsimdfp_access(Disa= sContext *s, /* Generate an architectural singlestep exception */ static inline void gen_swstep_exception(DisasContext *s, int isv, int ex) { - bool same_el =3D (s->debug_target_el =3D=3D s->current_el); - - /* - * If singlestep is targeting a lower EL than the current one, - * then s->ss_active must be false and we can never get here. - */ - assert(s->debug_target_el >=3D s->current_el); - - gen_exception(EXCP_UDEF, syn_swstep(same_el, isv, ex), s->debug_target= _el); + /* Fill in the same_el field of the syndrome in the helper. */ + uint32_t syn =3D syn_swstep(false, isv, ex); + gen_helper_exception_swstep(cpu_env, tcg_constant_i32(syn)); } =20 /* diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index a743061e89..a3a1b98de2 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -487,6 +487,22 @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uin= t32_t syndrome) raise_exception(env, EXCP_BKPT, syndrome, debug_el); } =20 +void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome) +{ + int debug_el =3D arm_debug_target_el(env); + int cur_el =3D arm_current_el(env); + + /* + * If singlestep is targeting a lower EL than the current one, then + * DisasContext.ss_active must be false and we can never get here. + */ + assert(debug_el >=3D cur_el); + if (debug_el =3D=3D cur_el) { + syndrome |=3D 1 << ARM_EL_EC_SHIFT; + } + raise_exception(env, EXCP_UDEF, syndrome, debug_el); +} + #if !defined(CONFIG_USER_ONLY) =20 vaddr arm_adjust_watchpoint_address(CPUState *cs, vaddr addr, int len) --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570437; cv=none; d=zohomail.com; s=zohoarc; b=YmoT4buf703GSW1ELXYH2zyaRUGJompvKg0SfgrqYdbGlIkduvPD+2YSIAiANTcHH2ZvdiMy7irPpwtazeZMOufYAHqOKicTeKJ8N8/HS19kxwYDWS0/cydR1ceFf+fRJSmVQSZDVF0JjcX38NTBOFgdNgbzrrh48Q8baWxgnEw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570437; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QmQpF4c3kmNYfBUp2TaNf+q5uPwew90N4u3cCME1guM=; b=DhE/P6OSBY01Gqmt9gb7O9hcFTxbZ5dnmD0164FwCLtGKLsTGuVS+ZmvT7uY8HZ7xh82NKrFc/LX6rpmkT/qNvXoXqLy25TiknIaA8DUDVOO3mK4ipWVjqfORkltM9x7hmM9qYleRztKZ5z75i+YTQLTV4scQ6K/rqh5YtiQBUE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570437781306.23714614304356; Mon, 6 Jun 2022 19:53:57 -0700 (PDT) Received: from localhost ([::1]:40634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPLu-0001eC-V1 for importer@patchew.org; Mon, 06 Jun 2022 22:53:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33202) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG5-000759-6l for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:53 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:38776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG1-0000M8-R8 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:52 -0400 Received: by mail-pf1-x42b.google.com with SMTP id e11so14269823pfj.5 for ; Mon, 06 Jun 2022 19:47:49 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:47 -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=QmQpF4c3kmNYfBUp2TaNf+q5uPwew90N4u3cCME1guM=; b=S75OyDrHT4Ouydsi9/9DRIbIH3mKmfUEFFrJgCseFhXmE7yNKV+7dcwFRF1iY4E4PL 7X/Y1fZiDLJRtpZpZoU0zgTGDCp2Os8ogyGkKWamru7yh5Hp145Kk/WPcPyFrf3geFvX Ce8zB96w9N+uxV1vvNZz2c1H7/XvFzE3aXP+ttNszllnBdtjnKX9XW0Oqqcx8BsCdtjm QcwItBVvVEIKyF6Rv6Gx9lurVPXi6Foqaz1bYAsIptqSROCdPjV7thOWQBm9oPmB0cEf PpaSrEbvvF46RKVZUsDiqwIvTU+seoFrfITTiQR52UkntMNHw17jzo5Fmieg1uEeFSku 0v9g== 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=QmQpF4c3kmNYfBUp2TaNf+q5uPwew90N4u3cCME1guM=; b=YROSyD9bbth7GJlmbxHa7XmkLTSI9+/11kiAuod7+kP3Bplj4yTYqUhDFZ7peS/UP8 WeGFj1yIob/X32CNGK7ivXbXXqfvn6PeuoVCd7SOVd3dgz6qB4DxhYX70xiG6asBc467 MCKQAreA1vUisAuwzH4YjEHG3keofyzXc0JVQeywzB23bkKAa5X/vVWUe8oL5AMt5/BO A2C2c0+DLmvDR8UUVz0V1eJjWI9vFXrREGwh9CajuLQIJkUVZtbglhlphtVIudgbjfV/ 40f1n4McRXWbhU4rP0+uJCFg+e1nRdkb+fcwKbvvea34hmXtneGgS1GlF9XKm1bjjsb4 +hRQ== X-Gm-Message-State: AOAM532mwrtIeYTLdlRLRrZBwbreNrHttdy1cwHstsxhk1uQ6P/1w/NM BNdKdsavJnggqKj5fkfQ/ctis0+7k2c6TA== X-Google-Smtp-Source: ABdhPJxqXJFZu2AMz7J49wEmhg1xhbrnBlog/s92iIhYTuU3D8mN+e++qGzGXz6LJSzbK2z1/UdXyg== X-Received: by 2002:a05:6a00:1485:b0:518:e601:dffb with SMTP id v5-20020a056a00148500b00518e601dffbmr27330492pfu.38.1654570068384; Mon, 06 Jun 2022 19:47:48 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 15/25] target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL Date: Mon, 6 Jun 2022 19:47:24 -0700 Message-Id: <20220607024734.541321-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570438781100001 Content-Type: text/plain; charset="utf-8" We no longer need this value during translation, as it is now handled within the helpers. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 6 ++---- target/arm/translate.h | 2 -- target/arm/helper.c | 12 ++---------- target/arm/translate-a64.c | 1 - target/arm/translate.c | 1 - 5 files changed, 4 insertions(+), 18 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 92c9758e86..5224dc2c85 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3085,11 +3085,9 @@ FIELD(TBFLAG_ANY, BE_DATA, 3, 1) FIELD(TBFLAG_ANY, MMUIDX, 4, 4) /* Target EL if we take a floating-point-disabled exception */ FIELD(TBFLAG_ANY, FPEXC_EL, 8, 2) -/* For A-profile only, target EL for debug exceptions. */ -FIELD(TBFLAG_ANY, DEBUG_TARGET_EL, 10, 2) /* Memory operations require alignment: SCTLR_ELx.A or CCR.UNALIGN_TRP */ -FIELD(TBFLAG_ANY, ALIGN_MEM, 12, 1) -FIELD(TBFLAG_ANY, PSTATE__IL, 13, 1) +FIELD(TBFLAG_ANY, ALIGN_MEM, 10, 1) +FIELD(TBFLAG_ANY, PSTATE__IL, 11, 1) =20 /* * Bit usage when in AArch32 state, both A- and M-profile. diff --git a/target/arm/translate.h b/target/arm/translate.h index c720a7e26c..4a93cac65f 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -59,8 +59,6 @@ typedef struct DisasContext { */ uint32_t svc_imm; int current_el; - /* Debug target exception level for single-step exceptions */ - int debug_target_el; GHashTable *cp_regs; uint64_t features; /* CPU features bits */ bool aarch64; diff --git a/target/arm/helper.c b/target/arm/helper.c index 40da63913c..eeca1a5dc8 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13630,18 +13630,10 @@ static CPUARMTBFlags rebuild_hflags_m32(CPUARMSta= te *env, int fp_el, return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } =20 -static CPUARMTBFlags rebuild_hflags_aprofile(CPUARMState *env) -{ - CPUARMTBFlags flags =3D {}; - - DP_TBFLAG_ANY(flags, DEBUG_TARGET_EL, arm_debug_target_el(env)); - return flags; -} - static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, ARMMMUIdx mmu_idx) { - CPUARMTBFlags flags =3D rebuild_hflags_aprofile(env); + CPUARMTBFlags flags =3D {}; int el =3D arm_current_el(env); =20 if (arm_sctlr(env, el) & SCTLR_A) { @@ -13667,7 +13659,7 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState= *env, int fp_el, static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_e= l, ARMMMUIdx mmu_idx) { - CPUARMTBFlags flags =3D rebuild_hflags_aprofile(env); + CPUARMTBFlags flags =3D {}; ARMMMUIdx stage1 =3D stage_1_mmu_idx(mmu_idx); uint64_t tcr =3D regime_tcr(env, mmu_idx)->raw_tcr; uint64_t sctlr; diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a5c66ce085..b45039a124 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14644,7 +14644,6 @@ static void aarch64_tr_init_disas_context(DisasCont= extBase *dcbase, dc->ss_active =3D EX_TBFLAG_ANY(tb_flags, SS_ACTIVE); dc->pstate_ss =3D EX_TBFLAG_ANY(tb_flags, PSTATE__SS); dc->is_ldex =3D false; - dc->debug_target_el =3D EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); =20 /* Bound the number of insns to execute to those left on the page. */ bound =3D -(dc->base.pc_first | TARGET_PAGE_MASK) / 4; diff --git a/target/arm/translate.c b/target/arm/translate.c index c7d422b541..b8a8972bac 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9350,7 +9350,6 @@ static void arm_tr_init_disas_context(DisasContextBas= e *dcbase, CPUState *cs) dc->v7m_lspact =3D EX_TBFLAG_M32(tb_flags, LSPACT); dc->mve_no_pred =3D EX_TBFLAG_M32(tb_flags, MVE_NO_PRED); } else { - dc->debug_target_el =3D EX_TBFLAG_ANY(tb_flags, DEBUG_TARGET_EL); dc->sctlr_b =3D EX_TBFLAG_A32(tb_flags, SCTLR__B); dc->hstr_active =3D EX_TBFLAG_A32(tb_flags, HSTR_ACTIVE); dc->ns =3D EX_TBFLAG_A32(tb_flags, NS); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570798; cv=none; d=zohomail.com; s=zohoarc; b=OeGG5V/UmIaLuxtSr25yJ6WfYvzfhkWWjVceso4apxvhaUqDCtMO29Pz6OvmojnjPMUCmgfLqAtby1THjflY5u8p0YV8nk/be3HmX/CvfQb38UQBnyOuvYCmh/cLmRV+ISdsB65s+gRUKgLAMOWr777ieQBlQYS/rJv4GUILKEE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570798; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9sduqmZOJTOFPInX5kBPwJ1DQBTH1uy7cOYRBrDTuaM=; b=aMNj8FQ3PiRAytyigXnlrs3HWG9oCkxdtrCX438Qnnq3hzBQv3q+bktozcchAEZvjA9o/BUSGBZ0yoU4Xp7OYKUPpi9sLegwyFGH/oJKLY3beaa8Ws8TQ70doAks5LhKZK3/91wITDu0s4wPtLskJ28MUyMqfV/maqzffpRHh+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570798325858.4034232606479; Mon, 6 Jun 2022 19:59:58 -0700 (PDT) Received: from localhost ([::1]:57576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPRk-0004fz-Uq for importer@patchew.org; Mon, 06 Jun 2022 22:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG6-00078m-4S for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:54 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:45975) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG2-0000Gf-BW for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:53 -0400 Received: by mail-pj1-x1031.google.com with SMTP id w2-20020a17090ac98200b001e0519fe5a8so14193990pjt.4 for ; Mon, 06 Jun 2022 19:47:49 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:48 -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=9sduqmZOJTOFPInX5kBPwJ1DQBTH1uy7cOYRBrDTuaM=; b=gcunhvgicin5IT+6Iih8IhEdEAoA79K3pKRGYVRMSCY1h6R4oWtcRf4vk6ZnNyK0ko LApMcM+4yU2ex5kS1HvvJXZstLr5OwFkZLsnCdg21dX5oNe5IOF2CZ4nyszdVMJrlJ3K CcMKDckNyPLwVdNsCGH4oPC6aSmsv0Sxz0alcnPMLCuudlHacG3k3lI/ZL0tLGY4P+zr kkIdnKnt4498nn4WQv7TxbBxCAheba92XVwZYCgm+5bvc0qJ1GhhR2ItL89yXuokd8vi wrVwYWCREJr32D4p5xNATyX6IV2pQADdka/aDiObyPOXflDNpGA1c+KuqwhSbrPmCXfK 32cg== 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=9sduqmZOJTOFPInX5kBPwJ1DQBTH1uy7cOYRBrDTuaM=; b=kah8N0KXeC72KlC1Lz6maL4+4IRLmE3qd6Wpnv+Sipw0AVWNmtG7/zB9ioM4MzvO5c bxtieXhnIoZlgrxWwysM0rfIIxbNinYBxrhOQq71BHJz7aK3wdTTqoRDwWK0T/pUVRyd wre+fmWwJ7WlD8r4sSp2Ca7KOYNJ/DbASzGPpCpIgfkV2RxrCZ/SyHToT92Bk0pDsGqg DClUduDrlwoIWnT3zgf8yq7b2rhiC/FwU9J+ZvF1q/5J4nCWjNf7Kaz4p47BBMPVtC6K DxxsIX96DvQzFYqMwUSzKlC2WopvPz0Rv0DrUJn8ur8xtjZx4TCl57w6+dqB9saHnVF/ XjMw== X-Gm-Message-State: AOAM533t0l/7ySd9+Ax6U0WmoDOvS4klLdUPGtH/NbhfgbSdpwLBc8IM MbTfuQgEQYsvUG8frXU4GyoVO5rs0hIiZA== X-Google-Smtp-Source: ABdhPJy1j0QY1FopKxsysJrT0vtgwYPLKMtiG2qxfwaHQkWReyno287PsRCq856uAK8nMkycEpOL9w== X-Received: by 2002:a17:90a:e7c7:b0:1e6:8093:3fc2 with SMTP id kb7-20020a17090ae7c700b001e680933fc2mr29335173pjb.7.1654570069517; Mon, 06 Jun 2022 19:47:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 16/25] target/arm: Move gen_exception to translate.c Date: Mon, 6 Jun 2022 19:47:25 -0700 Message-Id: <20220607024734.541321-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570799421100001 Content-Type: text/plain; charset="utf-8" This function is not required by any other translation file. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.h | 8 -------- target/arm/translate.c | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index 4a93cac65f..d7a9acf5a9 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -328,14 +328,6 @@ static inline void gen_ss_advance(DisasContext *s) } } =20 -static inline void gen_exception(int excp, uint32_t syndrome, - uint32_t target_el) -{ - gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), - tcg_constant_i32(syndrome), - tcg_constant_i32(target_el)); -} - static inline void gen_exception_advsimdfp_access(DisasContext *s, uint32_t syndrome) { diff --git a/target/arm/translate.c b/target/arm/translate.c index b8a8972bac..fc5eafaeeb 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1086,6 +1086,13 @@ static void gen_exception_internal_insn(DisasContext= *s, uint32_t pc, int excp) s->base.is_jmp =3D DISAS_NORETURN; } =20 +static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) +{ + gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), + tcg_constant_i32(syndrome), + tcg_constant_i32(target_el)); +} + static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp, uint32_t syn, TCGv_i32 tcg_el) { --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654570846; cv=none; d=zohomail.com; s=zohoarc; b=P2EO2Kk3dA0PlzXW+8XEscjO6BUFxzsqR2bktUaxSZzmZdYaMr584cYxG0U0MYhxB7Qbqp7wqd4XW/qbrlI9QknbPvXMH7aDnzh/G3rM1KwfIjGd560Qj3hLoS/albEdnrf/jDLoPV7sGwoh4urtY+w3PyQDBRIOQJ1oZpC1fF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654570846; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hm5AJJ9rtEtZQmXdNnCESF6lpmFEuqmd0isJFAw5U8U=; b=dFAgiJosqsdHT9ChRl4Aa4EJbTYlw7P6z8pHVslI6GRlpKlukKiG+QBaMMPG0XnzY6AM1BxMHuCUzIgYQdCHx1KKEXKIkX5745SsuVN5oSPzbf9Fbncn6fbeKJOI3yTm6FhqpzvV06zO3QmN2f/RFsDpZmR0ecF5639KAQ5Nbcs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654570846592926.6599888036716; Mon, 6 Jun 2022 20:00:46 -0700 (PDT) Received: from localhost ([::1]:59090 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPSX-0005hC-IT for importer@patchew.org; Mon, 06 Jun 2022 23:00:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG6-0007Ar-O2 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:54 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:41613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG3-0000Gj-6I for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:54 -0400 Received: by mail-pg1-x52c.google.com with SMTP id e66so14528830pgc.8 for ; Mon, 06 Jun 2022 19:47:50 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:50 -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=hm5AJJ9rtEtZQmXdNnCESF6lpmFEuqmd0isJFAw5U8U=; b=MVRno+eqO4SRy4l0C6F0k4YFvNPNBKAM+OKGYSC5g6gg5W1m4DVSXTxX9AvUQFpxoS eVjCLEMQk28m/Z5xgFkjeFeLEbrh87ZT+PbM0f9Yq84GOdEduveCfRK591kUGJJu5vU8 VyNvReASNbxpB4PTEdKTbxhb1iG1k3KBco/itnzySI4zNpjylODZHTKaOc6JWOgRVW5r Ii6qQ1+sIxo1S+vjZRv9hl3kdiogg/AMBB6bv/rvWWYInJyGt1cjL6+LL6x5FGBUrr8c xykpdQXwvnprbTPsLxiBpoZ522Me7QMbWKd28Wtki2Y2gBXfq3hEmDUmPVcb4K1dZk2M WFPQ== 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=hm5AJJ9rtEtZQmXdNnCESF6lpmFEuqmd0isJFAw5U8U=; b=Dg1enLLKJ62up908KFXW7NxMiNkRAbtzFnfRBuGWphWA67KIr41fyEHl/cux7x3iNT Prd3wQ20cBzZM3DoDlaYWyEUcRHIWeWXlK2VZmdJM1qnXLgQEjTvwWxtN6fm8iQGDQES YyU9pemDXPmireG7lS8YvbNBaauz48cvF69YEq9Dj+tJkCZXYMgvHk1P2NlTPTRsh0wq yr7pEopssQPpRWIokfqt38jcskPCGm6zKzYGiyRNMAj3ec+vAzCIX4FJWITHXZBRYqsP cJdgWSYQ2jnRdpycmpjNFXqAaOuxawGaJRyHvWoBhkewlTpf1TSmymBiAyZS5lHQZZua TMuQ== X-Gm-Message-State: AOAM533aRzO6Z70cuvpYRNaJ9EVtq2ScW8JKn6vKoNWP/0lAeN1SoM8A arc8jGtLSKHcMp5T4DJQpnnjZUY1JKSyqg== X-Google-Smtp-Source: ABdhPJyPodWX7XxznhRyPRFeJ9BfEnAv88uR+na13ewS6U6S4jlfcRBNceuayyxy1iivGmOmdJcCqQ== X-Received: by 2002:a05:6a00:88f:b0:510:7a49:b72f with SMTP id q15-20020a056a00088f00b005107a49b72fmr27102115pfj.21.1654570070368; Mon, 06 Jun 2022 19:47:50 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 17/25] target/arm: Rename gen_exception to gen_exception_el Date: Mon, 6 Jun 2022 19:47:26 -0700 Message-Id: <20220607024734.541321-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654570847615100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index fc5eafaeeb..edb7d3f394 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1086,7 +1086,7 @@ static void gen_exception_internal_insn(DisasContext = *s, uint32_t pc, int excp) s->base.is_jmp =3D DISAS_NORETURN; } =20 -static void gen_exception(int excp, uint32_t syndrome, uint32_t target_el) +static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_= el) { gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), tcg_constant_i32(syndrome), @@ -9758,16 +9758,16 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cpu) switch (dc->base.is_jmp) { case DISAS_SWI: gen_ss_advance(dc); - gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb), - default_exception_el(dc)); + gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb= ), + default_exception_el(dc)); break; case DISAS_HVC: gen_ss_advance(dc); - gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); + gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); break; case DISAS_SMC: gen_ss_advance(dc); - gen_exception(EXCP_SMC, syn_aa32_smc(), 3); + gen_exception_el(EXCP_SMC, syn_aa32_smc(), 3); break; case DISAS_NEXT: case DISAS_TOO_MANY: @@ -9828,14 +9828,14 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase= , CPUState *cpu) gen_helper_yield(cpu_env); break; case DISAS_SWI: - gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb), - default_exception_el(dc)); + gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb= ), + default_exception_el(dc)); break; case DISAS_HVC: - gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); + gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); break; case DISAS_SMC: - gen_exception(EXCP_SMC, syn_aa32_smc(), 3); + gen_exception_el(EXCP_SMC, syn_aa32_smc(), 3); break; } } --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571307; cv=none; d=zohomail.com; s=zohoarc; b=Z7u8Wny1fZ69hO+rimmO1OQmKDbr6u87xLPxESnPFAccFE93EW4BKxTTnH+mYo+iAlR5YaBs1IoXHvPyHnPmaWwavhsYsLKeV93OzKQJU1vpgtjX70VEkDhuhALbHJuogTf993cvOfrlNclOwWjNGE6ymHnmy/AlMDurkvHIBhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571307; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5ek6PL1aZJ6QfF3jqkeBuGSpjxRGu0Fp0N+Z+wPmIoE=; b=TK0mO9RVRneSfLas/X5ek1uppcXGky1hfUi4ss6s3cB90eqyBiOJKVPi907twIIL4wkO3I4XrVVIUBJomPUfRnMAkITVS1K8ofmHwHr4rGsJt4LL++OIt7UFxiuW5nG3Tsm1qhFlEkJPrntgVnBRjtknp9iJI9wj8RB5R+InyDM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571307154341.7861929773545; Mon, 6 Jun 2022 20:08:27 -0700 (PDT) Received: from localhost ([::1]:43928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPZx-0006Jb-OF for importer@patchew.org; Mon, 06 Jun 2022 23:08:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG7-0007EG-Cl for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:55 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:35376) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG4-0000NI-EF for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:55 -0400 Received: by mail-pl1-x62b.google.com with SMTP id o6so8581834plg.2 for ; Mon, 06 Jun 2022 19:47:52 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:50 -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=5ek6PL1aZJ6QfF3jqkeBuGSpjxRGu0Fp0N+Z+wPmIoE=; b=nmS6EnzY7A7b2UlbQcSL3YdbbctjWmW2MQYoo8ahBHDemu28b/eVZnPz4S6AzoKWeE +FkGAvIbWki1DzdScYp3H7S60UlOLFO77igZsha9ewT3EQC2FipBqjE10U1fb/+EB7BM S2MCTzZNIaJg9ZYauYn5aS6Ou0KfGK+Q0D0eJKCkUAJp7DyM869h0TEzOt66vFkrNDr8 5sCDDP0elmBYtyf75P1GUYNDi3LQNMyZQPGa2vyxygnOr3ImhMKKJHVbWlEk3PCLoGBU ZH9EC75jHyBQP4SEVyo7lqR2uCMxPTDdMS3RCpHkdCgzlv+k0t1wZ5x7Q3OViwH6MbN7 Vfqw== 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=5ek6PL1aZJ6QfF3jqkeBuGSpjxRGu0Fp0N+Z+wPmIoE=; b=3clD5OAkvWi53MzVtdfNsF3jqkmfaYUXjet2I9jvSwoJyO2BHb6t74y/SU9c1I1cGm Awop8T7B1SoC/d8nohjcI8KYqUOmnVG3AcshJ8ZQjRP+kcKwpt47uzqd/BSch5mFQ/gp meBqLszygL9Am7/Zl7DVC9Za6y6mHqUe65l44+7YSzqY3L9iZrPDUEQlRb+bGGOmWpTm iUEyyrHCCXtNCwJP6Ip2Ueyfj9885OZqxDvn5ymYp3tkMZw2690s4J6aeQiKrGtrGejd P1FBwwTkAHkwdxoGla1kPUtYiOqGvExpwtW46HakbztODz+7NCI38WW/PUZjOGyDD5LW ELvA== X-Gm-Message-State: AOAM533wus5/wLyvkg9NLbbgL2O4MEz8sGb369gE446TYz4FmlGeP6Qf 5OejKI65GGEWuklmMUnCE3Z9SYMoP43I+A== X-Google-Smtp-Source: ABdhPJw+Bi4vqj5ZzYYe2W2QD6EXSi/fJbXIcVDAZ4jCwDuzXZva+9+x0sXUeQLd7aRkG+5bzdMUGQ== X-Received: by 2002:a17:90b:1d08:b0:1e3:2a4f:6935 with SMTP id on8-20020a17090b1d0800b001e32a4f6935mr42556887pjb.174.1654570071071; Mon, 06 Jun 2022 19:47:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 18/25] target/arm: Introduce gen_exception Date: Mon, 6 Jun 2022 19:47:27 -0700 Message-Id: <20220607024734.541321-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571308030100001 Content-Type: text/plain; charset="utf-8" Create a new wrapper function that passes the default exception target to gen_exception_el. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index edb7d3f394..5a48937ede 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1093,6 +1093,11 @@ static void gen_exception_el(int excp, uint32_t synd= rome, uint32_t target_el) tcg_constant_i32(target_el)); } =20 +static void gen_exception(DisasContext *s, int excp, uint32_t syndrome) +{ + gen_exception_el(excp, syndrome, default_exception_el(s)); +} + static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp, uint32_t syn, TCGv_i32 tcg_el) { @@ -9758,8 +9763,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, = CPUState *cpu) switch (dc->base.is_jmp) { case DISAS_SWI: gen_ss_advance(dc); - gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb= ), - default_exception_el(dc)); + gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thum= b)); break; case DISAS_HVC: gen_ss_advance(dc); @@ -9828,8 +9832,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, = CPUState *cpu) gen_helper_yield(cpu_env); break; case DISAS_SWI: - gen_exception_el(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb= ), - default_exception_el(dc)); + gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thum= b)); break; case DISAS_HVC: gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571529; cv=none; d=zohomail.com; s=zohoarc; b=ZupzqAanGw6aRDb9L7bfLnWhqlvdMTbrsKa/HrOU/hwUYtF5FimQJs9q4mQtweg8hL33RHyNzhmZNUua3qfidBCcmqY/OcJke4JrMq3tGwdwG4K2hVAiuG/PMCWbVLo8qrlVatB13NGu++4jkYo6NWErC+tKMSoJ3DIQ06CFp30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571529; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sDCwZBt9IIzx83ZkNxq+1Z/y6VvrCzl9tcBCjhjfsAo=; b=mE+zTDkAk6UtppFhl7VF8sRTykVxk+vwxg4A0N5gNRwDIeTtQUOlb3CnezPocK842eujGE6neSeCcsmhVI+yt7RkchrSFfNO5h0IzZRbGI5N4IICB5l3nrarc1A/hPaP90g/7epZ0hU8UkWzLHGlC7SvxmJCAd03afcNQbaz25o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571529681164.86357978647823; Mon, 6 Jun 2022 20:12:09 -0700 (PDT) Received: from localhost ([::1]:50326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPdY-0002Ir-Js for importer@patchew.org; Mon, 06 Jun 2022 23:12:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG7-0007Fy-US for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:55 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:50905) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG4-0000Gg-V4 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:55 -0400 Received: by mail-pj1-x102c.google.com with SMTP id e24so14463894pjt.0 for ; Mon, 06 Jun 2022 19:47:52 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:51 -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=sDCwZBt9IIzx83ZkNxq+1Z/y6VvrCzl9tcBCjhjfsAo=; b=WRptN6pdTcIqEG69kgAFDqkXvMIbJZ33WHWHTPNUw9pIffdD478XoYTdH5J9idTIkK cXNDs1VrN1Az3s4ygsP5DGtcBWGkA4yfxr+8tymw/HLxJoxyz//T6j2b2p5jfMGHGaP7 6iGBazHKelbZ8JngzmdhfempcJoWc5BC4zyyArIncurSW6xHHNgGdrc9rMSSMZ/6T1Z/ vsrdi2joPC6WVJM3YVEY2sMiOtQzpMmGi2+ZgrndG7BoDhetcwUv/2iHi1mUjZse0rEI 7Gi6muKPLgKIQSuEd7ucL1Oe3vuWy+Rl2bGjIuWWGE4mFm2DFllY8gbJCHOyNme80Bw9 ObZQ== 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=sDCwZBt9IIzx83ZkNxq+1Z/y6VvrCzl9tcBCjhjfsAo=; b=KJF7a7aeLQgrcMQGHeVFQrVoiSIwuJyE1qEk0v57WtUD4FQvAhVgjNmgDyiPgc3qz2 0JQwJ/0x26koyx/8Qh73jiPRsegtBNcUoTILSS+tGMI4voAE4yOgT0k/uQHWsjpxWoTd 8QGtieuMjMOFBXD5zbLmK5RV0kSka2yJ+PWjT1yYy+DxWuRAY6NTlBNq6PntppbLwwap klN4jPTvvOfXJ/S2K7jAWqegjSbtIDAmQC/JBwqPdEyn4fZKK4poDGsNXMRGHVK4USTS aGZVEXmzyoFv9awZ6mWgiz/XsYpyUv/29nOnprkkU6aO0gdEPgY3FyqN3lv92ZP4Z9KN wvOg== X-Gm-Message-State: AOAM533QsUzwnoXn0K36VUas/6PEN1E87TuS3gEztarzQgkJbiu6lD7A MWSv2/SF4QYITu4fcwgBm/4BH2PhIZfwUA== X-Google-Smtp-Source: ABdhPJzsAIglNtBG+W+e9NGLppqrEqB2czo7lb6jgKiPuIMWkgolNgsB/j3VV1ej7NnMBPQoWkXEQQ== X-Received: by 2002:a17:90b:1c92:b0:1dd:10ff:8f13 with SMTP id oo18-20020a17090b1c9200b001dd10ff8f13mr63985762pjb.54.1654570072102; Mon, 06 Jun 2022 19:47:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 19/25] target/arm: Introduce gen_exception_el_v Date: Mon, 6 Jun 2022 19:47:28 -0700 Message-Id: <20220607024734.541321-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571530884100001 Content-Type: text/plain; charset="utf-8" Split out a common helper function for gen_exception_el and gen_exception_insn_el_v. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index 5a48937ede..fcb6ee648b 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1086,11 +1086,15 @@ static void gen_exception_internal_insn(DisasContex= t *s, uint32_t pc, int excp) s->base.is_jmp =3D DISAS_NORETURN; } =20 -static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_= el) +static void gen_exception_el_v(int excp, uint32_t syndrome, TCGv_i32 tcg_e= l) { gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), - tcg_constant_i32(syndrome), - tcg_constant_i32(target_el)); + tcg_constant_i32(syndrome), tcg_= el); +} + +static void gen_exception_el(int excp, uint32_t syndrome, uint32_t target_= el) +{ + gen_exception_el_v(excp, syndrome, tcg_constant_i32(target_el)); } =20 static void gen_exception(DisasContext *s, int excp, uint32_t syndrome) @@ -1107,8 +1111,7 @@ static void gen_exception_insn_el_v(DisasContext *s, = uint64_t pc, int excp, gen_set_condexec(s); gen_set_pc_im(s, pc); } - gen_helper_exception_with_syndrome_el(cpu_env, tcg_constant_i32(excp), - tcg_constant_i32(syn), tcg_el); + gen_exception_el_v(excp, syn, tcg_el); s->base.is_jmp =3D DISAS_NORETURN; } =20 --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571855; cv=none; d=zohomail.com; s=zohoarc; b=hH+o0OkSNjWlgxqDoviJx/f45bqTDIb3ST9o5N/8g628ffw0QmqIJW8mJpUaonm/bzowpYrJIej2LArihUTh/h9cerffwyUmsKSHyz/8LY2RR2/9XklvMl7zNMkIGHYSy4E4OHiZ98gHemJE9mchE80OL4pCCi/VvA0M7kdxsZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571855; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fmcSScOvBsLp1FCuWvkHw14JpRNt+9SUrqF6b0wzTB4=; b=LalkwXQg431ZSE+rvs1UVoG3QiYtZZ9xUBqRYCUOTw8faZqOUCO/OGbU8iEmfeRtRfRZZRM0q/3B5Yk5pgARQS8zpU53FQP2X7CPrGdzwtAE6y9rz79Ul3QK52TJdam/eJ08sYKZ10wBtOijGAMxqWi859pWV0h9CvbK5ahoi/U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571855656709.3138371766444; Mon, 6 Jun 2022 20:17:35 -0700 (PDT) Received: from localhost ([::1]:56540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPio-0006jB-3J for importer@patchew.org; Mon, 06 Jun 2022 23:17:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33348) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG8-0007Gz-6v for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:56 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:39670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG5-0000LU-PU for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:55 -0400 Received: by mail-pg1-x52f.google.com with SMTP id q123so14546302pgq.6 for ; Mon, 06 Jun 2022 19:47:53 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:52 -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=fmcSScOvBsLp1FCuWvkHw14JpRNt+9SUrqF6b0wzTB4=; b=gQCRtQE9nY0xUiu7z6tvUqImkQerplI16gNaFXAWHVghNLiilZcTNw8bPjh5uoLZfA ISbeyxWKDg7wOMMO2vwDtxcf/PtuMZRkUrohtaV7MtN/GDFMFyAG5dIKyy8V65PaFGiB xN2/gI7wAQAqbPu4U9OHsptJnPfejfn0kDeLb3T+S/TPWghpx+jp/GkX4UfP2l4tsAoI QwKOIG/r1DCFZSw4kRX+I4RCkc5RMkPLS/7YxVqA07F114NsFlFukMiyz//YHWQ7S4sO 8KKhIbAkjQKtb/DPslpCxh7QG8DyoBREO3kGuDDFAxr+aDbZMXxG/Cp/I6kN5UhGPRI0 M/nQ== 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=fmcSScOvBsLp1FCuWvkHw14JpRNt+9SUrqF6b0wzTB4=; b=pD9YPU4kBQhz4tgrGwjM6/lWjB/ZBjTIIJRvheBS/Qgne7exoxcA3QTDDMFD9wMiQR UjAZePaM4xJ2UQrWQ/MNVAQ2baGau0r4HvM02vQt5m1a0etOEPBA2LDO/q5l349lU5hs jjx62aypa9eas/fNW7UB2Q+wL4hRDP5rMZ34PNz/2lG23dOXnBOO+Va12VigJcQbrOhC 332s5cR+6fkLJlIjcPSyAXEdfDr9Iw9HxVIpeQoaokigRfOETAJs74Lu9UQzPM8mJQul B3XBJ1u9sp6YBSo96DbNNYjxucRS85t1iBMRKWhouToNP77KdVEuWHxf/6VjfYyf3q0I 7A5w== X-Gm-Message-State: AOAM532DQWrgzqL0OQgr7J6BWTYmn358oxk581SXSjGIj9r4o8SWeSKf Almx4KXVVddxI+KKTjjuO10tPpxjOK2ZEw== X-Google-Smtp-Source: ABdhPJy0R3wUgqSLUGO2kotaKYdp30CJ8fyJ88lSptwmurMw38OBGt3MXiOrjNAZ+596bLXwipXfGw== X-Received: by 2002:a05:6a00:2344:b0:51c:157f:83d5 with SMTP id j4-20020a056a00234400b0051c157f83d5mr9414718pfj.5.1654570072971; Mon, 06 Jun 2022 19:47:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 20/25] target/arm: Introduce helper_exception_with_syndrome Date: Mon, 6 Jun 2022 19:47:29 -0700 Message-Id: <20220607024734.541321-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571856509100003 Content-Type: text/plain; charset="utf-8" With the helper we can use exception_target_el at runtime, instead of default_exception_el at translate time. While we're at it, remove the DisasContext parameter from gen_exception, as it is no longer used. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.h | 1 + target/arm/op_helper.c | 10 ++++++++++ target/arm/translate.c | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/target/arm/helper.h b/target/arm/helper.h index afc0f1a462..7c8133f83a 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -45,6 +45,7 @@ DEF_HELPER_FLAGS_2(usad8, TCG_CALL_NO_RWG_SE, i32, i32, i= 32) DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, i32, i32, i32, i32) DEF_HELPER_2(exception_internal, noreturn, env, i32) +DEF_HELPER_3(exception_with_syndrome, noreturn, env, i32, i32) DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, i32, i32) DEF_HELPER_3(exception_advsimdfp_access, noreturn, env, i32, i32) DEF_HELPER_2(exception_bkpt_insn, noreturn, env, i32) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 1c4e6753f6..32e2a92ff4 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -391,6 +391,16 @@ void HELPER(exception_with_syndrome_el)(CPUARMState *e= nv, uint32_t excp, raise_exception(env, excp, syndrome, target_el); } =20 +/* + * Raise an exception with the specified syndrome register value + * to the default target el. + */ +void HELPER(exception_with_syndrome)(CPUARMState *env, uint32_t excp, + uint32_t syndrome) +{ + raise_exception(env, excp, syndrome, exception_target_el(env)); +} + /* Raise an exception with EC_ADVSIMDFPACCESS. */ void HELPER(exception_advsimdfp_access)(CPUARMState *env, uint32_t syndrome, uint32_t target= _el) diff --git a/target/arm/translate.c b/target/arm/translate.c index fcb6ee648b..81c27e7c70 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1097,9 +1097,10 @@ static void gen_exception_el(int excp, uint32_t synd= rome, uint32_t target_el) gen_exception_el_v(excp, syndrome, tcg_constant_i32(target_el)); } =20 -static void gen_exception(DisasContext *s, int excp, uint32_t syndrome) +static void gen_exception(int excp, uint32_t syndrome) { - gen_exception_el(excp, syndrome, default_exception_el(s)); + gen_helper_exception_with_syndrome(cpu_env, tcg_constant_i32(excp), + tcg_constant_i32(syndrome)); } =20 static void gen_exception_insn_el_v(DisasContext *s, uint64_t pc, int excp, @@ -1123,7 +1124,14 @@ void gen_exception_insn_el(DisasContext *s, uint64_t= pc, int excp, =20 void gen_exception_insn(DisasContext *s, uint64_t pc, int excp, uint32_t s= yn) { - gen_exception_insn_el(s, pc, excp, syn, default_exception_el(s)); + if (s->aarch64) { + gen_a64_set_pc_im(pc); + } else { + gen_set_condexec(s); + gen_set_pc_im(s, pc); + } + gen_exception(excp, syn); + s->base.is_jmp =3D DISAS_NORETURN; } =20 static void gen_exception_bkpt_insn(DisasContext *s, uint32_t syn) @@ -9766,7 +9774,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, = CPUState *cpu) switch (dc->base.is_jmp) { case DISAS_SWI: gen_ss_advance(dc); - gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thum= b)); + gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb)); break; case DISAS_HVC: gen_ss_advance(dc); @@ -9835,7 +9843,7 @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, = CPUState *cpu) gen_helper_yield(cpu_env); break; case DISAS_SWI: - gen_exception(dc, EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thum= b)); + gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb)); break; case DISAS_HVC: gen_exception_el(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654572021; cv=none; d=zohomail.com; s=zohoarc; b=mYy+O0gQf7f5/S567z4DYvja7OOS/JizBjjk11JSAnah7yvBcYixsQ2eVd2Zwyjq11QdSxjLDC3OxSWkP5P22UTT+2qSEZnMFhSsuT2hUYGiLkzTFdk698VAI7GsYr+/sfbOljVQun3TS/Jk6Y63jV7cjq8R1ARho3nXA3bU0uQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654572021; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6fpGwv3kCXG8ZtfQZNZua0/iQeuwiDUTLYdlJx9okG4=; b=G38wtOENjZZ3mXOhKXL0xTIv1DdKzS/zoXXlb/BtOKb+Hglz3Q7nKwSkSvrKqCjVNQhF6SQMjrUl2uN1gmOk7IsgSoGwHiA5FNpjMMffBachX1eL70EAmgHDRVYBb/x3jYgSiCz3jP0GXx/KLwrfpWaWWnJtgjHJMt1zjcrGi9A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654572021522738.7749301649725; Mon, 6 Jun 2022 20:20:21 -0700 (PDT) Received: from localhost ([::1]:35218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPlU-000382-1m for importer@patchew.org; Mon, 06 Jun 2022 23:20:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG9-0007Kt-An for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:57 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:40945) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG7-0000OZ-Dq for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:56 -0400 Received: by mail-pf1-x430.google.com with SMTP id z17so14274064pff.7 for ; Mon, 06 Jun 2022 19:47:54 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:53 -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=6fpGwv3kCXG8ZtfQZNZua0/iQeuwiDUTLYdlJx9okG4=; b=Gtj4lgnlDJP0UcCIfJj0C4utjUIMBCR3LwbDYJBzEo2BGgQvzWu+R5Vo7F6bZK26VE J6Gs341t8bpbgmDfl60Vpqvn6NuBAXZyGEeMyeUQcMEXueyKZleRi5jkl+r/bWWeQOLe KNLjp0bktfXUnfbrvu/A+nvjeuiAjTEOGwnmRYY30yVKuTg1TsA9XZTWLUASX5DdN/rz u5U+dU4VDRbgv4yGbL2SXU22MypoSgCfnoM+PrvFisZFq+CV8sdvuyki7wkXyMmbyVqp RMFXn33tao0M0GcfX6Q6iyW8nL32ZeB51v5zAlnWU+wyRzKbl5FZ4793QiAFfLQCqQJd ODgQ== 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=6fpGwv3kCXG8ZtfQZNZua0/iQeuwiDUTLYdlJx9okG4=; b=ydf1KNjZVIqYTbO+zAzkmqi6UczUiO1VeLrMCgITtfIrvlqnJIkdtJto3Yn5apJLJ6 UKkIfW3D552cUkZKxGh4Y/swC6OJ9hEWe7ISgVfiM78uqu/sqkskpd3LXha7mtROmOQm y4LhlF7wvZKgaTOeYcc/Br2cU1hjCtEZJZv+zfw1ACFjsIg50kmDOZcMPwj1XlNZzfKg 9BawBO2R0AGUPBTUUxvzyM74mmpTb/H3JrTqvnV+BUA4h1SclYEbOQeGpyBaTP/4K4PS u1mjJUrcM/xwVTpVM7QfJW/xNd0R97UnFbyzICw4krf087p2g1ttWAvb/g8L04SN1CrN /BTg== X-Gm-Message-State: AOAM533r+DdImOZ1novT0vNQDf6gvGV8EvPbkBew/40dVMIW0BncTLjE 1MPSJppuoacdb3dHJtw4InK7mo0otW/31Q== X-Google-Smtp-Source: ABdhPJzIBQWpvrd1kUjm63CdH3NVAxfXJaQkaLjnoHL08HMTkKVGWBY5SvMFULBP2cHoDJ9v0wiHPQ== X-Received: by 2002:a63:fa56:0:b0:3fc:d3d2:ceac with SMTP id g22-20020a63fa56000000b003fcd3d2ceacmr23481606pgk.99.1654570073961; Mon, 06 Jun 2022 19:47:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 21/25] target/arm: Remove default_exception_el Date: Mon, 6 Jun 2022 19:47:30 -0700 Message-Id: <20220607024734.541321-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::430; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x430.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654572023187100001 Content-Type: text/plain; charset="utf-8" This function is no longer used. At the same time, remove DisasContext.secure_routed_to_el3, as it in turn becomes unused. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/translate.h | 16 ---------------- target/arm/translate-a64.c | 5 ----- target/arm/translate.c | 5 ----- 3 files changed, 26 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index d7a9acf5a9..b01a58653e 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -43,8 +43,6 @@ typedef struct DisasContext { int fp_excp_el; /* FP exception EL or 0 if enabled */ int sve_excp_el; /* SVE exception EL or 0 if enabled */ int sve_len; /* SVE vector length in bytes */ - /* Flag indicating that exceptions from secure mode are routed to EL3.= */ - bool secure_routed_to_el3; bool vfp_enabled; /* FP enabled via FPSCR.EN */ int vec_len; int vec_stride; @@ -199,20 +197,6 @@ static inline int get_mem_index(DisasContext *s) return arm_to_core_mmu_idx(s->mmu_idx); } =20 -/* Function used to determine the target exception EL when otherwise not k= nown - * or default. - */ -static inline int default_exception_el(DisasContext *s) -{ - /* If we are coming from secure EL0 in a system with a 32-bit EL3, then - * there is no secure EL1, so we route exceptions to EL3. Otherwise, - * exceptions can only be routed to ELs above 1, so we target the high= er of - * 1 or the current EL. - */ - return (s->mmu_idx =3D=3D ARMMMUIdx_SE10_0 && s->secure_routed_to_el3) - ? 3 : MAX(1, s->current_el); -} - static inline void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) { /* We don't need to save all of the syndrome so we mask and shift diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b45039a124..8da2ca8324 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14584,11 +14584,6 @@ static void aarch64_tr_init_disas_context(DisasCon= textBase *dcbase, dc->condjmp =3D 0; =20 dc->aarch64 =3D true; - /* If we are coming from secure EL0 in a system with a 32-bit EL3, then - * there is no secure EL1, so we route exceptions to EL3. - */ - dc->secure_routed_to_el3 =3D arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3); dc->thumb =3D false; dc->sctlr_b =3D 0; dc->be_data =3D EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; diff --git a/target/arm/translate.c b/target/arm/translate.c index 81c27e7c70..6617de775f 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9319,11 +9319,6 @@ static void arm_tr_init_disas_context(DisasContextBa= se *dcbase, CPUState *cs) dc->condjmp =3D 0; =20 dc->aarch64 =3D false; - /* If we are coming from secure EL0 in a system with a 32-bit EL3, then - * there is no secure EL1, so we route exceptions to EL3. - */ - dc->secure_routed_to_el3 =3D arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3); dc->thumb =3D EX_TBFLAG_AM32(tb_flags, THUMB); dc->be_data =3D EX_TBFLAG_ANY(tb_flags, BE_DATA) ? MO_BE : MO_LE; condexec =3D EX_TBFLAG_AM32(tb_flags, CONDEXEC); --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571488; cv=none; d=zohomail.com; s=zohoarc; b=ASYHufubfcyERXcNVgo0vVrUWtVMhbD0LBPU5MfOKsQmNA42aRa9TdZMzPTypp01sysSbHUdWLqo9vQm4AL4MaFHm+pP/0XYUIuU0VwdLJL1Rr0oTPbR1T08sN7Na7SjJsny4bNXBdwXg6ubfWa0TgOewlYj6Wbh44rPnGaR6ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571488; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M/oXSdjZYbwmqBajIXGiCmaX0gX1NZRS+oLXplWu0qM=; b=DQJugEwOTche6NA0RjZ1ayGnXi/cQhrRKQeWxPTQ/9mjMjst8SQiiIICP77WsH+Mr7cJXCPiR//3CDUhSDtpTsKUiYnTi3jHl3o3sAg6ZtGDy6S+m/QF8hGYocTaFWyuEOKYpYxF0kYenLcf3q41dOyEkoW85LOaZ/MmgoEVK5U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571488274831.2209545400517; Mon, 6 Jun 2022 20:11:28 -0700 (PDT) Received: from localhost ([::1]:49226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPcs-0001ZP-M7 for importer@patchew.org; Mon, 06 Jun 2022 23:11:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPG9-0007Mk-V7 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:57 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:37635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG8-0000P3-6P for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:57 -0400 Received: by mail-pg1-x52b.google.com with SMTP id h192so7759991pgc.4 for ; Mon, 06 Jun 2022 19:47:55 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:54 -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=M/oXSdjZYbwmqBajIXGiCmaX0gX1NZRS+oLXplWu0qM=; b=B5ckQxBr8yKhdl2yn0HNxyZvPq7eyHKoXSQH9IPmQh8AC/fvYPI0lzio4FefGZGqN6 hDUHLy0WQPu7t6Qjm0wyt4pF2M2DhL/04LaSQgJsLZ36XAZdfXKbtOgNehMhulR28RmI 2xMrmGM1j+ugRe4maTqMMk+7Gex8nkZ5aegliUXStgr03ctjIJBgQrjddkdXr9EBnt6q GwSCZtk77Era62eH18ckKe9g/jWs+jJ50e3aJtyWI6cyLKNe5GVIouNdRk5FZazUVhWX 625mdPpmt83Kg4jqbsktgF6WxrF7QMpZJowZJkkX1+zn8E/cs1oScLexthDszJ0WvOew 80KA== 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=M/oXSdjZYbwmqBajIXGiCmaX0gX1NZRS+oLXplWu0qM=; b=G0tYoU5v9ZZLu7oCev1XsC6CAj/x/xcov8tYDRPJ57UF0m1G+pB72r2IIS6obhXjX0 0emcjRPmKHjsy0NthMAPLXHJSz57WXUt/FyJt7r7K1hjlvgGq5gYZUfc6Txr4xaKW9VP fZsFal9xujc6wGSvmxMONf7zX8or08AsRxkNiEW83sd7kEatXW+Hjmkju57+kgHGFfCE VOmcJ1bLPqBDRKO2SPOUItSy3uHykKq3VPgYjQJaECWQIVIX5QHeurn5xIx7+w2i67B9 N4X1Sh/KY08XqUcpbQog7RjljDY1R6sh7+yBZCxw7K448ny6ssuRMWED0uU7F5rFYxTK 5szw== X-Gm-Message-State: AOAM53056R1Tz/tHbSYvbXtMTDSRsWxJ+KbpGbcbOTsnI03D4DV0i4up OZObGcQNZfLOq2rszMQPGIEXNRP6EQ+wSQ== X-Google-Smtp-Source: ABdhPJzxZ0QLcE0i4bVefLnQpARfa91WCmEWsUs3oMWvyT7Yg6lF5SYJHstBzlb6VII/Zq1RhG8wZQ== X-Received: by 2002:a63:6306:0:b0:3fc:7529:7688 with SMTP id x6-20020a636306000000b003fc75297688mr24011902pgb.252.1654570074807; Mon, 06 Jun 2022 19:47:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 22/25] target/arm: Create raise_exception_debug Date: Mon, 6 Jun 2022 19:47:31 -0700 Message-Id: <20220607024734.541321-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571488734100001 Content-Type: text/plain; charset="utf-8" Handle the debug vs current el exception test in one place. Leave EXCP_BKPT alone, since that treats debug < current differently. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/debug_helper.c | 44 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index a3a1b98de2..26004df99b 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -12,6 +12,26 @@ #include "exec/helper-proto.h" =20 =20 +/* + * Raise an exception to the debug target el. + * Modify syndrome to indicate when origin and target EL are the same. + */ +G_NORETURN static void +raise_exception_debug(CPUARMState *env, uint32_t excp, uint32_t syndrome) +{ + int debug_el =3D arm_debug_target_el(env); + int cur_el =3D arm_current_el(env); + + /* + * If singlestep is targeting a lower EL than the current one, then + * DisasContext.ss_active must be false and we can never get here. + * Similarly for watchpoint and breakpoint matches. + */ + assert(debug_el >=3D cur_el); + syndrome |=3D (debug_el =3D=3D cur_el) << ARM_EL_EC_SHIFT; + raise_exception(env, excp, syndrome, debug_el); +} + /* See AArch64.GenerateDebugExceptionsFrom() in ARM ARM pseudocode */ static bool aa64_generate_debug_exceptions(CPUARMState *env) { @@ -418,19 +438,16 @@ void arm_debug_excp_handler(CPUState *cs) if (wp_hit) { if (wp_hit->flags & BP_CPU) { bool wnr =3D (wp_hit->flags & BP_WATCHPOINT_HIT_WRITE) !=3D 0; - bool same_el =3D arm_debug_target_el(env) =3D=3D arm_current_e= l(env); =20 cs->watchpoint_hit =3D NULL; =20 env->exception.fsr =3D arm_debug_exception_fsr(env); env->exception.vaddress =3D wp_hit->hitaddr; - raise_exception(env, EXCP_DATA_ABORT, - syn_watchpoint(same_el, 0, wnr), - arm_debug_target_el(env)); + raise_exception_debug(env, EXCP_DATA_ABORT, + syn_watchpoint(0, 0, wnr)); } } else { uint64_t pc =3D is_a64(env) ? env->pc : env->regs[15]; - bool same_el =3D (arm_debug_target_el(env) =3D=3D arm_current_el(e= nv)); =20 /* * (1) GDB breakpoints should be handled first. @@ -450,9 +467,7 @@ void arm_debug_excp_handler(CPUState *cs) * exception/security level. */ env->exception.vaddress =3D 0; - raise_exception(env, EXCP_PREFETCH_ABORT, - syn_breakpoint(same_el), - arm_debug_target_el(env)); + raise_exception_debug(env, EXCP_PREFETCH_ABORT, syn_breakpoint(0)); } } =20 @@ -489,18 +504,7 @@ void HELPER(exception_bkpt_insn)(CPUARMState *env, uin= t32_t syndrome) =20 void HELPER(exception_swstep)(CPUARMState *env, uint32_t syndrome) { - int debug_el =3D arm_debug_target_el(env); - int cur_el =3D arm_current_el(env); - - /* - * If singlestep is targeting a lower EL than the current one, then - * DisasContext.ss_active must be false and we can never get here. - */ - assert(debug_el >=3D cur_el); - if (debug_el =3D=3D cur_el) { - syndrome |=3D 1 << ARM_EL_EC_SHIFT; - } - raise_exception(env, EXCP_UDEF, syndrome, debug_el); + raise_exception_debug(env, EXCP_UDEF, syndrome); } =20 #if !defined(CONFIG_USER_ONLY) --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571831; cv=none; d=zohomail.com; s=zohoarc; b=dGyw9bEblvDGix7QCcNZKAjXhOZ+F6Fovvc03DuZ/Sb4qzWLZkEz3JakQUr7lBgolLWpQJ1ZTijD/4cp8XW71PzhSmjaCWFKjOo30XUIt9tr60dlAoVRaSxz6lFiOv1NoCTr4+lJVW1/GaoxY/QNp9QB4A1eD4o6ob6i+q/bg9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571831; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DResuf4yvFSsZX3asYb/x0WdRbn6myIqroBLohdXR6s=; b=LBNEbkiWP+rX1w2MsitMqGsvu5x5BUWry6G+q5ylwBNrb96iBmxlE5feMPfwoTkIBb+2Buc0jBN28jlbo7qzhQig+9ME2jFtdWtSg8CvhiyEu41b3L5jxmdvOF1PDEwEBc93aI0Su2b4OOGiUBEX2ZwLwXWHKSv6udwckslNflA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571831714671.4806687059386; Mon, 6 Jun 2022 20:17:11 -0700 (PDT) Received: from localhost ([::1]:55614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPiQ-00067G-FZ for importer@patchew.org; Mon, 06 Jun 2022 23:17:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPGA-0007O0-93 for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:58 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:35820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG8-0000KW-Le for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:57 -0400 Received: by mail-pg1-x535.google.com with SMTP id 129so14560156pgc.2 for ; Mon, 06 Jun 2022 19:47:56 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47: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 :mime-version:content-transfer-encoding; bh=DResuf4yvFSsZX3asYb/x0WdRbn6myIqroBLohdXR6s=; b=T1iGVGo//xSotjD6+Dq6ruzGkNWUpbqCm0ZzIwPVfGh9qz5pykd7UBic/emjHfpD2v uSdPEpDxf25fUGeWpaDYqyT/smhqIPAdwi4FW3jZ+jnNRVrRlOWcMQa++7EqH7WlKlJE MWAEbmH+hfDBKTClcxJNN69IKYPMMooHaF4r6W9uvL3Nsac6jakv4+p9fHdj/bX2OS7V dOLpf8pujV68G+dccUjt+SzRurQ1TY3NOMZQMaHecctSU56FxNbNV35ivxvQ0RjtAZGv bhrkr2r3H3XaiqRc/LQyon0HMK3EbGJdS2yMDhQUEWGLyAphHuV+G74lzwfiKBZDkF4r D43g== 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=DResuf4yvFSsZX3asYb/x0WdRbn6myIqroBLohdXR6s=; b=p7g6CD5ts/zN1225K9JTzql2flS/ZtzqddJEKkjphiatU78RsZE+LpvTs4pB8um/YB eonD6mtBc/AHWTcEt/1Vz5FAK3ypv5DprJvxX+VMTAo4rS9MHkTFjpDnDzVfF6EAHs3N 24LQ9OE1sLdEcNo/24n6A26IIxHaeEMGsYqX11XeTYluX8+eqF9coziqiWMVqILd/IZV NwtsMuPCtP7M0hbI5q3rkR038MdD6f7v/fxT477wlIuNK6OiLqDdDynLO6Jyec419dFU z8XCdEFV6qk5g/7RXb0m3TiMpLDXk80mEQoErDKlCeycNYrZCTDR+s7BKsKyv7Tw4Ya9 k+Ig== X-Gm-Message-State: AOAM531jIP5OvMAOOgBVVF0PWOyj6w75iEpxmLSOAqTuqJo+dpQWETP/ 55aipuw06DV7HzvQ3M804HTV9gBQtrRZIg== X-Google-Smtp-Source: ABdhPJyRutMRxZwejtxi+0Fojz5JlQZKTJZVmBB5f6C6Pyv4G7wP6mtFeRMCLtazqJrjCMvuVh3ROg== X-Received: by 2002:a05:6a00:1344:b0:51b:e3b5:54e2 with SMTP id k4-20020a056a00134400b0051be3b554e2mr19648969pfu.6.1654570075809; Mon, 06 Jun 2022 19:47:55 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 23/25] target/arm: Move arm_debug_target_el to debug_helper.c Date: Mon, 6 Jun 2022 19:47:32 -0700 Message-Id: <20220607024734.541321-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571832477100001 Content-Type: text/plain; charset="utf-8" This function is no longer used outside debug_helper.c. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 21 --------------------- target/arm/debug_helper.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 5224dc2c85..5bc6382fce 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2967,27 +2967,6 @@ typedef enum ARMASIdx { ARMASIdx_TagS =3D 3, } ARMASIdx; =20 -/* Return the Exception Level targeted by debug exceptions. */ -static inline int arm_debug_target_el(CPUARMState *env) -{ - bool secure =3D arm_is_secure(env); - bool route_to_el2 =3D false; - - if (arm_is_el2_enabled(env)) { - route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || - env->cp15.mdcr_el2 & MDCR_TDE; - } - - if (route_to_el2) { - return 2; - } else if (arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3) && secure) { - return 3; - } else { - return 1; - } -} - static inline bool arm_v7m_csselr_razwi(ARMCPU *cpu) { /* If all the CLIDR.Ctypem bits are 0 there are no caches, and diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index 26004df99b..b18a6bd3a2 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -12,6 +12,27 @@ #include "exec/helper-proto.h" =20 =20 +/* Return the Exception Level targeted by debug exceptions. */ +static int arm_debug_target_el(CPUARMState *env) +{ + bool secure =3D arm_is_secure(env); + bool route_to_el2 =3D false; + + if (arm_is_el2_enabled(env)) { + route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || + env->cp15.mdcr_el2 & MDCR_TDE; + } + + if (route_to_el2) { + return 2; + } else if (arm_feature(env, ARM_FEATURE_EL3) && + !arm_el_is_aa64(env, 3) && secure) { + return 3; + } else { + return 1; + } +} + /* * Raise an exception to the debug target el. * Modify syndrome to indicate when origin and target EL are the same. --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654571176; cv=none; d=zohomail.com; s=zohoarc; b=CcIO7AqNf2T1O1TAkG5CwT2/DwTRUKVsn6X6mXCI752YAKoGMUA0LVRs3iwzB4uzN7eDlBgIXNjJE+WATroFmwIrG6b1OMUavje9030GmGL53nWysWv3Z1+mVBqcsEE/BAwKwgOcWjHbOcSNBElvnbNjATrhw8nbvYZhMDaHTJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654571176; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0e5X8Giy1nSXUAW/k2gk27MTQNnTOPX0p6C0iMqD4S4=; b=gFC2tCoVZSRlTD+IClRfAHgrzszzrqWdCxt1TT0DGLFMMNQoHy6aKH6eEcqnNdEXkwwvxyl7wJk7JKFTuovvTrIbvvdl5dzhkmFDRjcKnHTiBCBgyvX5x7LdoxKedFozOHRcS/ZMCufIlQvpjZFjxpmKy0HEDKw1meEM5U2P9PU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1654571176260605.7127507087215; Mon, 6 Jun 2022 20:06:16 -0700 (PDT) Received: from localhost ([::1]:39446 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPXr-0003Gd-1q for importer@patchew.org; Mon, 06 Jun 2022 23:06:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPGC-0007SZ-Ig for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:48:00 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:44569) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPG9-0000Pt-VG for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:47:59 -0400 Received: by mail-pf1-x42a.google.com with SMTP id g205so14256710pfb.11 for ; Mon, 06 Jun 2022 19:47:57 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:56 -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=0e5X8Giy1nSXUAW/k2gk27MTQNnTOPX0p6C0iMqD4S4=; b=XGI3okjrgtRS82YWE588I1XHQFlpIW2GvSuFsNkKbDAPIMG62yQ0Z96xOjU+LPVduy tIyhHQoOGzweZmUXgGkOPLiGXf7tKr6LR3Rwg29zQW0vlXRF2wc68mKCrCtNsvEcT1gU Xac3dE9D7IEaXQEPQBl7Q/10yrDys5/JF07kgkSQnkC5VxlM46vgd9pT2AlGIOvBbBjZ kV98iBIWQkSahRbyzbKJujNosfO4T4/iAKBFZJhe5S8zwrWLMvKCc8A11nAtSsWyd5ff 84k1eKIkfRRmX1I3qxJiJu6NxS+MNRXCMraP8+eBT4foiETQg3DWljF6CzYE61FzF+Hb fcYg== 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=0e5X8Giy1nSXUAW/k2gk27MTQNnTOPX0p6C0iMqD4S4=; b=JwEv10VyPkg1JS9mJ8RZPqdtU40dCaBxzoGL4wnVmS5rfTrw2+lxr7SK8wmMgFpjz1 klx7vsF7jrlPRrvJRP9aj7ez0lHBNihB4GKENTfuDhTEEgxz97nTcS+Op1j57KDGOszb sk99WFvv3MTA5DDBQBkxLW0MudyV6kemUPooaAq7iq3tXfWpPVsmVCmDvj2IjouuGaQm 7dCCvIaejedQ4/Q/BDqi6OuRP5iko3SCGNo6K+Wxt0fICLrGQzrdg4WWesiHMOdzzNLT AUPk7vTU7tgJ7DepyIYG95JsjAReYJxsDBMOdWepLcFCGObdFaCLtkCWxygqPm+SxLXG ARBA== X-Gm-Message-State: AOAM533QhnqvdoVsjteFcsdL1L/i7v7lT5jL60f/vhbOtXkoFE7tdoX2 yIYhAB0ae17Vg4yFSB74Iw+SsSnnDRAo5Q== X-Google-Smtp-Source: ABdhPJym/PkOGOYOZTf6P95Y0dIo6UCP1wXTVypFbqk4L/rGRFNtOIVzVNYzm2gCaGNtN5iMRYb9dg== X-Received: by 2002:a63:24e:0:b0:3fd:d5d8:9b91 with SMTP id 75-20020a63024e000000b003fdd5d89b91mr5555067pgc.458.1654570076602; Mon, 06 Jun 2022 19:47:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 24/25] target/arm: Rearrange Secure PL1 test in arm_debug_target_el Date: Mon, 6 Jun 2022 19:47:33 -0700 Message-Id: <20220607024734.541321-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654571177406100001 Content-Type: text/plain; charset="utf-8" Not a bug, because arm_is_el2_enabled tests for secure, and SCR_EL3.EEL2 cannot be set for AArch32, however the ordering of the tests looks odd. Mirror the structure over in exception_target_el(). Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/debug_helper.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index b18a6bd3a2..59dfcb5d5c 100644 --- a/target/arm/debug_helper.c +++ b/target/arm/debug_helper.c @@ -15,22 +15,24 @@ /* Return the Exception Level targeted by debug exceptions. */ static int arm_debug_target_el(CPUARMState *env) { - bool secure =3D arm_is_secure(env); - bool route_to_el2 =3D false; - - if (arm_is_el2_enabled(env)) { - route_to_el2 =3D env->cp15.hcr_el2 & HCR_TGE || - env->cp15.mdcr_el2 & MDCR_TDE; - } - - if (route_to_el2) { - return 2; - } else if (arm_feature(env, ARM_FEATURE_EL3) && - !arm_el_is_aa64(env, 3) && secure) { + /* + * No such thing as secure EL1 if EL3 is AArch32. + * Remap Secure PL1 to EL3. + */ + if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { return 3; - } else { - return 1; } + + /* + * HCR.TGE redirects EL0 exceptions from EL1 to EL2. + * MDCR.TDE redirects both EL0 and EL1 debug exceptions to EL2. + */ + if (arm_is_el2_enabled(env) && + (env->cp15.hcr_el2 & HCR_TGE || env->cp15.mdcr_el2 & MDCR_TDE)) { + return 2; + } + + return 1; } =20 /* --=20 2.34.1 From nobody Mon Feb 9 19:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1654572137; cv=none; d=zohomail.com; s=zohoarc; b=Y6WgId00GIie/20da5cmR98UCFVeT2UjDxFSinUZrPF6X3KMYaxUMFzFkct0bdPt05nPaXFhFRwdGDvjkLlOtXv4GJhUsMdSD85YPPjycJxSl7KH1vpMbtwUxy9a/Qc0uqWZogRnRPo4S+pl1XyVhn9gykYDiDsnn47i5D3bEbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654572137; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wQ71nJahwuqq+z7DVE0+r1oElsGD+n7N1FiHPA9m6ck=; b=exuJ7uKtYHcoa+8+X10YRLgX6pOwwBJaZc5BH/w5H0g3d5HgE3HYlhN+pK01y7xP9T3Y4wqxzDynwyNpIbDJzqyiH7G2MQnDKIDNx0tF6LyeJc+6WJB3JIhH6AieC1m0QD+kKblen56grZdYK1X4k3NeCDYT4mj+rl2XDIrHxkQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16545721378673.491566785267082; Mon, 6 Jun 2022 20:22:17 -0700 (PDT) Received: from localhost ([::1]:38194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nyPnL-0005RA-FJ for importer@patchew.org; Mon, 06 Jun 2022 23:22:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyPGC-0007Vf-Mp for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:48:00 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:33591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyPGA-0000QH-MS for qemu-devel@nongnu.org; Mon, 06 Jun 2022 22:48:00 -0400 Received: by mail-pf1-x434.google.com with SMTP id w21so14326498pfc.0 for ; Mon, 06 Jun 2022 19:47:58 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:d3db:cca:e5c9:6531]) by smtp.gmail.com with ESMTPSA id y26-20020aa7805a000000b0051876d83714sm7476904pfm.196.2022.06.06.19.47.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 19:47:56 -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=wQ71nJahwuqq+z7DVE0+r1oElsGD+n7N1FiHPA9m6ck=; b=vAFIFBzfip9YbJuILHAJ+0Ll9RvT/j5oI5SOqM7O7iUGgrLjL0xZNYU0KPwQnajshS szox5ZfepniHVgen2HiepStLT589/WcYr2nmXLPWSjBVNby2XqulbdIyNMy/QMXa0pBm /aV3M2BcwDMz5T4yT9ijOTzG/sbi2gJ7wq1RIbi/0wmDer7//CscuYMqOx+HTJXCcZ29 pBiGl8Fz2x+dD+UZr5p0r3JpLX0ZyqoPuAR91yC1bYNOR0bp3yVm+cygBcxPow3LGFH6 EsEDJ/2v7S/KrBLRIw8uOdTunIcPj+XvdmQ1JF58KWrd1vo8bRfXU3rhvsVB6ZU4W+dm RNVw== 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=wQ71nJahwuqq+z7DVE0+r1oElsGD+n7N1FiHPA9m6ck=; b=HUdGi1DgR8IddvvYibyCubpLFoUSKxoOxS+lNex5HZ4sd3fIBP1nI2JOLwiozx/HLM tRlQ2GvVHGe6IBk9UwAqWIVn5u3TYGFkOQdiqqpzQkTGL6MnQtyDrKOtnYX1fFEo/9GC nbyCk9eV5qYy2n4g5zkzN2pVP54G/o25bcJKVncn7mJHEIBoe7SxnFexoI/Mm9Wgkj6f MIR31z99oj+IkuSuwmyyeW2EXhuzlrL/XaCVcA0Aw++cqITdKPGTLrQ6ZP8qIbdZe5on zcwdddXviQ/4L218tpqeJ6Kinl8zW6J495OEQ1XrEfhUS4EiOZCgUyaDwcRRykuBpBlm uShw== X-Gm-Message-State: AOAM5304ZUXuXfJQQv4IvIBZVvKRrcOEM24kP9gTJeh/yneFfElBsiTl bq1HZP8Hhw9j2kte46Q7s7lWrs5F2IWyIw== X-Google-Smtp-Source: ABdhPJwG0VAQber75eYEHf5mnjVIrNLk4WbWLydH1GMHmXGjYdCrQSMnAx9egrhV/Ww7w5VS8wTckQ== X-Received: by 2002:a05:6a00:130e:b0:51b:c19c:44b0 with SMTP id j14-20020a056a00130e00b0051bc19c44b0mr27422448pfu.21.1654570077371; Mon, 06 Jun 2022 19:47:57 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 25/25] target/arm: Fix Secure PL1 tests in fp_exception_el Date: Mon, 6 Jun 2022 19:47:34 -0700 Message-Id: <20220607024734.541321-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607024734.541321-1-richard.henderson@linaro.org> References: <20220607024734.541321-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x434.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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1654572138190100001 Content-Type: text/plain; charset="utf-8" We were using arm_is_secure and is_a64, which are tests against the current EL, as opposed to arm_el_is_aa64 and arm_is_secure_below_el3, which can be applied to a different EL than current. Consolidate the two tests. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index eeca1a5dc8..1d81a01c94 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13400,27 +13400,22 @@ int fp_exception_el(CPUARMState *env, int cur_el) int fpen =3D FIELD_EX64(env->cp15.cpacr_el1, CPACR_EL1, FPEN); =20 switch (fpen) { + case 1: + if (cur_el !=3D 0) { + break; + } + /* fall through */ case 0: case 2: - if (cur_el =3D=3D 0 || cur_el =3D=3D 1) { - /* Trap to PL1, which might be EL1 or EL3 */ - if (arm_is_secure(env) && !arm_el_is_aa64(env, 3)) { - return 3; - } - return 1; - } - if (cur_el =3D=3D 3 && !is_a64(env)) { - /* Secure PL1 running at EL3 */ + /* Trap from Secure PL0 or PL1 to Secure PL1. */ + if (!arm_el_is_aa64(env, 3) + && (cur_el =3D=3D 3 || arm_is_secure_below_el3(env))) { return 3; } - break; - case 1: - if (cur_el =3D=3D 0) { + if (cur_el <=3D 1) { return 1; } break; - case 3: - break; } } =20 --=20 2.34.1