From nobody Sat May 18 14:01:37 2024 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=1654806801; cv=none; d=zohomail.com; s=zohoarc; b=ZIlZUAeLFpoF7h40/1TOAtAd70piiNSqY3ObP/ayBC/glqYashM5tPXuJQX2kGlLD3ySjj1tgG83+SpWlzsHnUb71OZBNh1P82d5DrRE9tY+XCHJPio7re/MXYe2PN6soj4YeQvSmSfu83NAxTADFgyvuCQ2c7Z0HuSGs1c4Vlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654806801; 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=dvs0msc/BgmzjzEJROn/Vw+WSdazjKEc4BurwezM6Ql+TiXHBVapX2s40yFA32e3eGtrfTECEExzvGaeBkHc2pCgeu3NXiRjEJZ5++tf7UwCKUPzZv1RS7nVNBAx4i8ThDIjkPaPefeVJVRegqUPPG2Mrzo5w2cZl1BCEx0BVsc= 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 1654806801334438.3426942922847; Thu, 9 Jun 2022 13:33:21 -0700 (PDT) Received: from localhost ([::1]:38632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOqF-0007Cq-Ld for importer@patchew.org; Thu, 09 Jun 2022 16:33:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmB-0003P5-AW for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:07 -0400 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:41791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOm8-0008QK-V3 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:06 -0400 Received: by mail-pl1-x634.google.com with SMTP id s14so21129058plk.8 for ; Thu, 09 Jun 2022 13:29:04 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:03 -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=l1YhcKHCsUdN75BWIz2PutUjbFgF20zXfGtsSwDGjhgVc3gHSEnd3DZUs4g0+joSvD +QwBlfNdXvcNV2ve38F4HPA6RXHap4DBW+TLV43gER1gM9fTMnOADik/sRP9yjcexvmf lghnzSZrdTgjXc/JR+DF4DKSNEAXHevtq6DN/BncymEVO6Yeko/GtqE7T+LU8hjKI6GC /fD1v2soX8uI5XSI1/5coEKM4GIzE7NQaKY+xwOmGFQl0NOpX9tWS4LDhDP1AtvfyNZk rrJvaqZpIN1U60R9OFCa8i2ivCOUyjULMpQBE8z9Q/atvL6r7cSoZSqxm1aRQuKCuV5N 6WTA== 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=eIdsBp7o9VGqLIsG/F1MFFVEDUk0Yjyv4uNxMByHVeTCHytLi3qS1tG5FN5Gj+6syB 1Oj7PwpRbxUPNHKBTmG8utzWFYQGYYBoUT6Dl5oiO0u66jJmlyt251YJ+jPUgXiu58eb aV6nZ1Gs4TfIWnC3wbos6858zdz7bA+eBcFr44Z+O2Hv9JqvBdNchJrCdmI1+BtATH0R nBXCBqr88jXG25SOgCU6+ForwX9qfuyBJbcuIQmCDvJqhykuCOIMTX4Mv7dWeW6ve8HJ /oIG1rqMN4mUOWnaG2c3mVCqE3wS2rJbbgsT3Uh3o3ogpF5OOkYz+TxbqNerceFCGhBW t5mA== X-Gm-Message-State: AOAM533VEfjOMoMrZ4yNg7kE8H6JtybIhDHh8fuE9ilpP5u04sjmt8aq wQNMGHyod4rqCXLKvnpORliNIoNcwZ0Kjw== X-Google-Smtp-Source: ABdhPJxNSYoenoOXWydUOipRzQjAYdq0paCzt6oW5IFALQRlrbx3dprmAjHm6aWv2n0wk9a+r7FLZA== X-Received: by 2002:a17:90b:350b:b0:1e8:5177:fe7d with SMTP id ls11-20020a17090b350b00b001e85177fe7dmr5205317pjb.142.1654806543691; Thu, 09 Jun 2022 13:29:03 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 01/23] target/arm: Mark exception helpers as noreturn Date: Thu, 9 Jun 2022 13:28:39 -0700 Message-Id: <20220609202901.1177572-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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=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: 1654806803322100001 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 Sat May 18 14:01:37 2024 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=1654806767; cv=none; d=zohomail.com; s=zohoarc; b=TPa3ADar1YLogKgQKJKaUVvNCPJLxfr/XD66RhyaruRBtO1J6TRee+VIQf2dECRZIEvHIfazGcB/ErtqyyGsvWs8b3ZU+Ihs+nQM7sItze01ybo31HmWZOQGQ+pPiw0tpjZUPy8F2bDCFCqkSwiRgGtYM8hk0+ZDh/FE9sO9wbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654806767; 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=45/1OP9sKZiLrriwOZd01nWrvZCCplxvhdpmrJtm+Zo=; b=fo7lCceLrR8VC4L2tCs9oCACEAlaGME/4vbkQJbDTCdQ1ryX86az6mjGD9GVsvrE9qOE7WgCOF8ge3qrTdyaW+H5JFC6vD+HJpTnLUQtAXHhnGzvDnYqtPopoTN1YxjjuBX31FXl/SStqNf+3BRFiDKtvofubmfxJ4ezzOl/v3I= 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 1654806767207314.2688762548022; Thu, 9 Jun 2022 13:32:47 -0700 (PDT) Received: from localhost ([::1]:37812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOpi-0006dM-3U for importer@patchew.org; Thu, 09 Jun 2022 16:32:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmB-0003QQ-Ma for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:07 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:52108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOm9-0008QZ-P9 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:07 -0400 Received: by mail-pj1-x1035.google.com with SMTP id cx11so22331417pjb.1 for ; Thu, 09 Jun 2022 13:29:05 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:04 -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=45/1OP9sKZiLrriwOZd01nWrvZCCplxvhdpmrJtm+Zo=; b=YDnrQ2v6WhH/ui7xH/Tg/6xrTudcXNeQLpK5jsqelBYi+1si6d7hFBA+55J5x0Hv9M stTLyJ//uVywXEUGR2x/T0f+nyKQZtMXy1HVjllBCzORjbAzANwrefT619PL/B8Mh2Wv gJQ7tYOcBi6OLbC9BKcqp3uVssOz0eteXzBcOak9whB8eU5OQ1ReSHnnihQPzJP6nZy/ lsOGDa8Slpf2LC5yDRifgAqS+XSVgdhCw1ZWZyoz49DQrtmLI59iv3nfwzz1W82nsPZl j7udzgm+YxOcLDW+DePQk57MVARTYpF3jkTxLuHt9HLpjJXTHn8+tNZnrBk4kEzr+QKz kcWg== 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=45/1OP9sKZiLrriwOZd01nWrvZCCplxvhdpmrJtm+Zo=; b=I9XoLrB3BCniLEekIXfVsYk4ahqnAfrC7IyBrF/7YOwFCmuiRwsmtMAImvpq4Fg9RV peI73bs3p0c9hl8TQFAAWkTQw3+8rF12NOV7565bSxAR/hNLXRfFmI9mrRGPsrlcI7t5 wmXmR/L2XgCyV7e5ms7dXL53U6P6/rvQk1c7yv5BGkcVFzgEU/hHTA86g3Ho3NrF7nVo fD80nKNaWS+v+1cTDCZ2iYQtEBfppvGr9dDH0O3MdSXAmis/lGBOFojkyO940+WLYx22 6tL/8qCdliShWBvE2GFpBF/seRUok0azNgSLcQ8n6Ta7r2+tguZT7gomsglqbNA5wV1X WcgA== X-Gm-Message-State: AOAM533HwCGubb3sv1NYraJdipA61uMd+CS29TFVXYoFeuW//lOr8vi8 wrvJagPH9iT2ZUcgAMLZaaudiccWF25SKQ== X-Google-Smtp-Source: ABdhPJwQVdbKIOcJkUXUbK4Ur5HsdGgNtsTLVZApvJPWENHrzvGM1dx58ebBRW0QjefxXeVXpRQAtw== X-Received: by 2002:a17:90b:4c88:b0:1e6:71da:5eb0 with SMTP id my8-20020a17090b4c8800b001e671da5eb0mr5048751pjb.185.1654806544397; Thu, 09 Jun 2022 13:29:04 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 02/23] target/arm: Add coproc parameter to syn_fp_access_trap Date: Thu, 9 Jun 2022 13:28:40 -0700 Message-Id: <20220609202901.1177572-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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: 1654806769171100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 d438fb89e7..e752589090 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 Sat May 18 14:01:37 2024 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=1654808029; cv=none; d=zohomail.com; s=zohoarc; b=cu/Gqi1dDyblAC/3ORQnLcisE3gp+Sf5Y67Hymdokp0FIMrLAWwlx/iNkx7OZEm9Bsau0ANGRuTx58Du44Krj/wnSKfK1Famko7dJ71xAWkxEsuFLMQLmlEFFXT7XiFetNaKOE265GoVh/AsscQUafS4aWReS50g2HiNIRIkS7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808029; 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=or4hVFMgSgQ4bkROq2u2MyvWBg+YN6u3/ulE0jHiq7E=; b=mR7auzs79wYn4EnMMwGr3br4TNx7yg68l3eEkgEdVLFWAeQYRFsfPr7Cdt8cCv/8XOmDrSRVo/ZNs1tqjIoHaZdbmr7+2puEEUfQEGlyfE6+XC7P5Ny5yfhHSyYAlHWUiIbnjybXhLALEie7bMQNybt6Ci7WDa0e0icd97r8yrY= 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 1654808029056107.46883599730563; Thu, 9 Jun 2022 13:53:49 -0700 (PDT) Received: from localhost ([::1]:40518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPA4-0003Wp-27 for importer@patchew.org; Thu, 09 Jun 2022 16:53:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmC-0003Td-Q9 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:08 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:39626) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmA-0008Qj-Ku for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:08 -0400 Received: by mail-pl1-x62a.google.com with SMTP id o17so21146793pla.6 for ; Thu, 09 Jun 2022 13:29:06 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:04 -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=or4hVFMgSgQ4bkROq2u2MyvWBg+YN6u3/ulE0jHiq7E=; b=d7qOLqSzGe3SlYCLMEVqsHC5BKw1lZfzjDZEXGYVdzvtks8WDH/nZQMAQuTo9YsgWh oL03qUF+wtt50SOLayegK2xisGzfOlh0xpjfWRTWwn5EFTv46vYcI6suN0DCgjnSoKTv 8DPVisZcIx3x45aA4xMIIWYAIA3ft627At2+zhkegA7QGaHLQOzL27QByfvYsspPEDUv HzGaeo1QFAHdjUAI+bxkC7/IyzXQpdIGtyx0WTd95nT2SPAu00NFYasPLFeLc709FxPf dtCZPMeXu9t+pdWGnsCmS718PGOv4tqHrVAMPJeFE69SM2LbJQv1tebYluvlDmmsIOhT geBQ== 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=or4hVFMgSgQ4bkROq2u2MyvWBg+YN6u3/ulE0jHiq7E=; b=xl3XAH+FW7EskUIjxHc79zsHVCcLDlEGMamavATlQEDthrjjvkBWIVNtn7EPbqUYvQ 7YQly/NERzf87UVAp1w5sJyzabrRVbN7k0wVEk31qtjgrPreM8jKmW/4PXl5e9JDkB0m +atkv9npimnG6EgTQf3gpTW9ln2arGdoH09vVRgcuvEIQ3Ipoxv17vVqzL2HRfVTE6Re 8qzm1VFPSyOJK7HEIwGqEQ7BOsDDbcc4vdwy/VUdd4iZPmly6wjbZwJneQ+VRRe4NUVH pT3VZiMIeeUzjSIChtSiRimYPcqHgSUXGGRC1oyjHS8qx5RXyqwMoM+aIToYjNyGRO4+ YpCQ== X-Gm-Message-State: AOAM5320dfyKkollCyuCaCprqH3riUePfD/dao/5jJRyzWUJQAHq1q48 VDBFcU/dTH1rnTMiXsLrPAG/mR44Nj7NNA== X-Google-Smtp-Source: ABdhPJzlr0xnccsdiBRtm3SRVsNYqwcj2OzaGLBdi5rGxoFU9zyZ8oh+sPLqMnZ0fr/VLWR9jAYU8Q== X-Received: by 2002:a17:90a:5c84:b0:1dc:9b42:f2cf with SMTP id r4-20020a17090a5c8400b001dc9b42f2cfmr5033134pji.123.1654806545247; Thu, 09 Jun 2022 13:29:05 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 03/23] target/arm: Move exception_target_el out of line Date: Thu, 9 Jun 2022 13:28:41 -0700 Message-Id: <20220609202901.1177572-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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: 1654808030738100001 Content-Type: text/plain; charset="utf-8" Move the function to op_helper.c, near raise_exception. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 a1bae4588a..af9de2dbe5 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1098,21 +1098,6 @@ ARMVAParameters aa64_va_parameters(CPUARMState *env,= uint64_t va, int aa64_va_parameter_tbi(uint64_t tcr, ARMMMUIdx mmu_idx); int aa64_va_parameter_tbid(uint64_t tcr, ARMMMUIdx mmu_idx); =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) @@ -1339,6 +1324,7 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu= ); bool el_is_in_host(CPUARMState *env, int el); =20 void aa32_max_features(ARMCPU *cpu); +int exception_target_el(CPUARMState *env); =20 /* Powers of 2 for sve_vq_map et al. */ #define SVE_VQ_POW2_MAP \ diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index c4bd668870..97c8c9ec77 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 Sat May 18 14:01:37 2024 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=1654807056; cv=none; d=zohomail.com; s=zohoarc; b=bkSljHTmgH4LmGuDVtVwCLjMr64M8cNXxqizf0bGeTJcKTjAAa7KC7FmjkKIFQ2qEJf8i3FWLTAtZWkJ2XCMILpe+JVLqJ957RcVTBf+WNsoXs3jZwg0j0Rc2/FSgRVetuuNYAmvnUorq0/+FMlTgon53HxxWYinWaeHX0P+IhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807056; 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=MrEhOa+yMtE+t8fOZfBlrA2frjHLPNVyhuaexNOThYc=; b=XB+HjG8r35kVOzew+R7mRzuSvWhKWu4IsbDI4UV43WlWBIO0he28vmly79D8ZWTyilIaN7SnLJZh2IJHaw5piEkRlZsOSMYXcW2+KdXwuL54OaVK3T5ceREVGtMOZ67H4VVf2k6f96mp4s2qvY1f4oFgGkPv089mDNizipsOPBU= 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 1654807056899362.63499581079645; Thu, 9 Jun 2022 13:37:36 -0700 (PDT) Received: from localhost ([::1]:46866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOuM-0004RB-Kg for importer@patchew.org; Thu, 09 Jun 2022 16:37:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42990) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmD-0003Uc-5l for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:09 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:40845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmB-0008RB-KN for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:08 -0400 Received: by mail-pl1-x62f.google.com with SMTP id i1so21129986plg.7 for ; Thu, 09 Jun 2022 13:29:07 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:05 -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=MrEhOa+yMtE+t8fOZfBlrA2frjHLPNVyhuaexNOThYc=; b=ZV22uVUUkEgpdPG4eIApV7/5PqnIL3Og6yWXIbEGC2AnIAk0xxkuEfZapqEEhOHwtU Ci2qBLRroqxP6SK+0ojy7z+cw36nNDBgaArM7PadPGWCfriPErVJg27bo9/fSEdrkt8r ebFvtVfQM7J5uzByCHBb/xiNUe6KPpwh7V4kjMTk35Q4ko854uhkthbgtQR4xgc7e5mv VjL+iUiovmz0YOmkdQ1+qNTzurj02/oFsbsJYuB02WUfV3yvsmC8QY2admPsTZV32/tT B2HR7i+ysM0zDBJci2K+s5X1IKwkW+CP5F5WuuUHdQSfHI/5jRBzX2Z8W4iyj+QiH10U 4O3Q== 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=MrEhOa+yMtE+t8fOZfBlrA2frjHLPNVyhuaexNOThYc=; b=wTBwirPpzmMZQTzHBw5l9NlfYLDDY/SJ2SIe9YRUpC+quQwlpz5cII6Hy7abNMMr+0 62G7UyK6GLct1HzxzoIqgMY1DEJHB2RlCdLX01SZNj0W8mkfBxEtKpgLMael6yBc05nH BZnV5d5rq2YkYoMWChV8vOn8CZKaJa5/ql0ZPjxEVleKCIVMwbxXSRvExDbfE6Y3VdpE TtBmWzrdAd1xMctFB3Ww0AVX2S5bYTn1Ft0l5jbXpjRA/BKtbWGm8D9X5PI3CTuEmm15 ZOmmNm/0qh4esdGu6owxNhXS7IjckLqKm69y+iIDEzI0ZSuVUz4JtLZF7dkepZyqSHrB xkhw== X-Gm-Message-State: AOAM531WMqNa0BQb1PRgzqJl3LHtkWghSHbvXJJ5SiYv0gkKjVz01ZMr 7/4k9DgpKTEMvJbuMXORjzCVVMKUoN+4wQ== X-Google-Smtp-Source: ABdhPJxSKVDd/L0FQZBMhlLKoa2N1FoMULZRMGjxCIAoHgI8P/zwOWAewCfOCR1zGTHyBHeX0bDCOg== X-Received: by 2002:a17:903:1c2:b0:163:ef7b:e10f with SMTP id e2-20020a17090301c200b00163ef7be10fmr40853642plh.158.1654806546215; Thu, 09 Jun 2022 13:29:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 04/23] target/arm: Move arm_singlestep_active out of line Date: Thu, 9 Jun 2022 13:28:42 -0700 Message-Id: <20220609202901.1177572-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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: 1654807059091100001 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 78dbcb5592..bb1dc3289a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3106,16 +3106,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 af9de2dbe5..64e2c1dfad 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1325,6 +1325,7 @@ bool el_is_in_host(CPUARMState *env, int el); =20 void aa32_max_features(ARMCPU *cpu); int exception_target_el(CPUARMState *env); +bool arm_singlestep_active(CPUARMState *env); =20 /* Powers of 2 for sve_vq_map et al. */ #define SVE_VQ_POW2_MAP \ 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 Sat May 18 14:01:37 2024 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=1654807128; cv=none; d=zohomail.com; s=zohoarc; b=lGk7Z5Hoq8IbACUTw0OWincbgBz3OYNZ+PsJXFPpAXcclQQs4wJFMhTLh5+njOt+KrYW4LvytchokSoGY2N4VY8WM+apmcSKwoRmz8pCehDQnlhlzrBXOJudXqHbNhWXks8wxGhfvwz5+N2CteX1tUoAierYtRzAEzAR4iA7wNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807128; 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=DvjfME7+Ka5kNm2PWO6mtYjQ90LhCIioEZBbUU3Qie4=; b=fpljwmAJER2IUedaYNgwwn3Suu2GlWmtSKfFlW98GYboBsJnOESVEiDHrLQCQsdPQRlD9xINUcI1dBcCgkTrpNkTDEeMKwG2UgOZ7G15sEY0Q6EeGPEVkELcacWAZoDxJzUy20jkQSkh5PASivo+YHQ8hAoEuD/bf7TNWWwjMB4= 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 1654807128825450.4311192348101; Thu, 9 Jun 2022 13:38:48 -0700 (PDT) Received: from localhost ([::1]:49356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOvX-000665-Im for importer@patchew.org; Thu, 09 Jun 2022 16:38:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmH-0003iw-JY for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:13 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:54110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmC-0008Rf-Dl for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:13 -0400 Received: by mail-pj1-x102c.google.com with SMTP id a10so22309580pju.3 for ; Thu, 09 Jun 2022 13:29:08 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:06 -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=DvjfME7+Ka5kNm2PWO6mtYjQ90LhCIioEZBbUU3Qie4=; b=HRyPnQswkDWpijO56F5AUjckxyFYu/uFG7bizMhvWa0jtwMwfzEl3ymxnPVKDCpfwj 7HewtWqFqPez0ynjzum667bI/HWCmWMlIJrAfuw0zx9rtia4HBlqNRiy1RsVTgDOmyux qijo0YykQfa5tJem3BfF8wdidUXyXB1NalRIi+5ZwbE261SOjKGXdJb++kjW1wyzUFaO uYJFRNM41n516vN2wD9rY8zT7rJ3w+r0OXKuFvkE4FWUbxKV/8/cqjMhHDa6V6ogI/hQ qKM3au5v1rRPgs0Z7GBfe3hAlcIR+a9Z3bS990eDsH3r6B9PK0sttt2DZehVY8FPvhuM inQA== 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=DvjfME7+Ka5kNm2PWO6mtYjQ90LhCIioEZBbUU3Qie4=; b=3ri5wTzUfiJU4NkDV/kCPnyBKk8m0Cyb8odvubkvWDU2/lNd3zciJGbvzJ80dQ3fZ8 hYg57pjFlZa+17qkOW9VHUDAQrTGxjZDZrU0MomxIemgZRRteF0MpqYBB4KNceGKVtkW DuQAWVJpUH4HKZh7JwFPI8EtsZ+NBKDRS28AEEQR0XJq+IGs/e84OCHo6KJeTSgCOrOu ZXpZcgIyUlldhpUKT/JItuN8OrBE9hOVQpodOVMIVjAdX6EOPRvIv2zKrgsSH/zhX7sc jpBSp54DD4iAaULl9pRW2oEVovQKwpoc6hiMolw8g5f0U5V+givIem4C8e5Nhej1fLkT ti6w== X-Gm-Message-State: AOAM532RqfIj7HpPyIlb/SqYhYz40wq5M+tzSke9FjqwbJw1WrvWnJvv JGeuat5Qd9zSvPrdqik0QKSBoQbYb+yAcw== X-Google-Smtp-Source: ABdhPJwFv/gprCIhmD5ELL4uOluRR55rhiX+BvrTN7GutRzAzGk29AHKR+SQ1WIYXtfbGqv4uICMRw== X-Received: by 2002:a17:902:d2c1:b0:165:d4cd:e118 with SMTP id n1-20020a170902d2c100b00165d4cde118mr42385400plc.4.1654806547118; Thu, 09 Jun 2022 13:29:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 05/23] target/arm: Move arm_generate_debug_exceptions out of line Date: Thu, 9 Jun 2022 13:28:43 -0700 Message-Id: <20220609202901.1177572-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=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: 1654807129881100001 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 bb1dc3289a..50b5a9c9fd 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3015,97 +3015,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 64e2c1dfad..02fa70f75a 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1326,6 +1326,7 @@ bool el_is_in_host(CPUARMState *env, int el); 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 /* Powers of 2 for sve_vq_map et al. */ #define SVE_VQ_POW2_MAP \ 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 Sat May 18 14:01:37 2024 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=1654808299; cv=none; d=zohomail.com; s=zohoarc; b=nLKWAJoTcU5KsTzySL+NUmilNWGrKQUizB1Q1xwhckWRlvbAbZqNdTfZo30cgY0rFHKON+ffc9vG5z1bqB6lrIhZt5ldXqOE603bIEZkiZDsz2Vj7JZMOIzuJ6RJ7eczkr577ceRViXC8mIdgLNxEdyGjV4VrATF58xxTIUchP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808299; 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=HJNcDB/nRHy/lC0bSdjTZexP6JcMMPzkxnWAGiOOfq3HQgL5ILm53cI2CpmHapHi3WlkIU+231rCzLkedHx78UwcQQVL1XBx3O0IvzFXLcbVJpByFmWn5zygrWbgs5Bv1YMDFs80/bLOi6cZuKwLFipEwvDdzJRvLYuWMJHgNVI= 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 1654808299002893.2519764477468; Thu, 9 Jun 2022 13:58:19 -0700 (PDT) Received: from localhost ([::1]:48316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPEP-0001CI-TK for importer@patchew.org; Thu, 09 Jun 2022 16:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmE-0003b1-Sn for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:10 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:46961) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmD-0008Rz-FT for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:10 -0400 Received: by mail-pg1-x52d.google.com with SMTP id c14so22823379pgu.13 for ; Thu, 09 Jun 2022 13:29:09 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:07 -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=bPty2NdEKHE35lMWD9se1mbyIEhUyWDa41JV5I9vM+dO5NKupJHsRxU2yNOEmbpusF EhZH0IfJCEUbyWNtSawlrwWu0rOy4YOUY78TDw9bh83kRMmtPSXkvmf08lK6DexJ6x8t pLNdd70S6FB+fFuUxyVqm5/O4NL4oEaThtfC8nVg6Qavq80sofJ8xKiMem5rMkaW3gm4 4soP62tFYNXXUMjjeufpByn78MxyvnvXqN2gE3Rgpq5ewWj50xiM8R3IypFxZUAKw8ZX 6/vkHD+Li+hPTNsnbA+Et37QW0nPIjT0mmBbJJ9cO7Q47pnDiQCMoojlEv5tasoREMqn uhLg== 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=mLYGmQ7MVmmnezfzCmbbJbW/RsONAOffVhtwNvIxphcGNIGDXiVNtJhsrBaAtYMCS4 J3CfPNAy/SF9QsLbRscKQcPka5+cL8CwQT8oqteuzZ5fAx9id203vrZ7WurN/wq+5WQE 7dKKhdMRlsDrXSOjqWtLxVCVMhXC1boIDocwutqrkuSjc/63Jj2MesLH1FflyjtcZTe8 dwBQmcNQrOBV8B0sWggi/GgvhU9KuUZDP6bsWsehsNhC1cj7zAiNYjdeQGizn6RlZ4zh nYdYWWvyHfibBjh/RCTFaGj9oZyt3M1y1/S3TnYoM1Z4Kwj8BcysaeDwozpBixTlP7og 0eOQ== X-Gm-Message-State: AOAM531ZZw3ef/rjdRYUoZDj/tosMb4nwEpJwT99IL6hLwNthClJtVgt DPOeTH5GJQO4kXiSNyN4ZW5vSSABeZr0JQ== X-Google-Smtp-Source: ABdhPJw6N1IFNJLccqnNYitKiF4theAKORM3WfKUB/dioazAf2Qa+lpzSoFhpWIMNgz2rgzGd8Tg0w== X-Received: by 2002:a63:2a16:0:b0:3fe:192a:2d3 with SMTP id q22-20020a632a16000000b003fe192a02d3mr11525941pgq.39.1654806548002; Thu, 09 Jun 2022 13:29:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 06/23] target/arm: Use is_a64 in arm_generate_debug_exceptions Date: Thu, 9 Jun 2022 13:28:44 -0700 Message-Id: <20220609202901.1177572-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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: 1654808299491100005 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 Sat May 18 14:01:37 2024 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=1654807341; cv=none; d=zohomail.com; s=zohoarc; b=Yw1dFU7R+5P9V2o4KeJNvXX4RXWFz9IoNNhVmFzqHrclCAe6MABRpilzJvzTYCekZJ0NWUhlLM2kvXhUTROqFSlaopuhDVHqSUkcwwE/UpBYe6/rdzLglIRKqu0AW6WbHF6jNId8MDsCNwqXaLlsEzHR3WjiIprmHv+KWE3qiyM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807341; 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=kj2ZYfRQGSWcXMLkNM8zljFGjh4Y1FzFkf5hNzLBiyI=; b=dQ3/T8HdRWtc+/8jC2bkGeTVFQ6HY/B6LQwagG5/FNeFFz9SOPK8VbTSAVe7ImxJZRUb81uZsq/UDaOlblhMCfWBxHUXxs5/UhxfKVXUWjK6FIcptA34xFkZO21DMamENJSl2yTY5oW9Kyy97YklwHiVJcJCPKl6laz4t70gN3g= 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 1654807341788726.3103997652496; Thu, 9 Jun 2022 13:42:21 -0700 (PDT) Received: from localhost ([::1]:55564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOyy-0001xx-LG for importer@patchew.org; Thu, 09 Jun 2022 16:42:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmG-0003eU-3C for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:12 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:36435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmE-0008SQ-8z for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:11 -0400 Received: by mail-pl1-x62d.google.com with SMTP id u18so21154957plb.3 for ; Thu, 09 Jun 2022 13:29:09 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:08 -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=kj2ZYfRQGSWcXMLkNM8zljFGjh4Y1FzFkf5hNzLBiyI=; b=QmusMp69D93YwXt/7TOjJMXhkbte6nFaynuJ6DlS9+82QVE5I5dDyJD5/7g7pdGmyE xmhHthrgXobgre1xJCfHsEetJzDucay2DV2f9WO+dOWK+IxmHFNNe1nkmqQmE5WQlWtX AdlXXmxOfJL2DOWKlZjpZnIuufHv1yzuaqtqcVoHolZUaG0e8+QWTuMvxL0wPNjrq/xO Pb4ldVG9UXXj3axqtqKb4e9sFuc8hAjTzLQAU39ChG1itLNDaz/WtszMs7hSRO8q+FgV 1CNinAGTpSyub7lZjUuwJCXTkmsgVIIoM7YdF2FQ8dAbbOPbmRFWLGh+3JHX4iiE4Lir gEAw== 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=kj2ZYfRQGSWcXMLkNM8zljFGjh4Y1FzFkf5hNzLBiyI=; b=cYgROeCw3XH//fliES6OpmAobaYxeXtb0I8vL5MoLhmgGB42AoJTrsphwg/wwVT6Vm jw39C0XygKN6LSFngUyr+IyPBjda6kg8i08CHzG2ivdA51OgremkLnGpD+32eq7DJ+7e hdKBDEwiLAFlbyjZHYqepId48t3Dt5woSGPrGgMUfVF2Uc/FQKCDqn7BNS0b45nZWACH BHTq1m0/6aifVbMJrI/o/uZb3ySCLtYoJ/HfkbUa83H77+P+GuG4bTtg/GEX283xhwDD SNJIr2bDE8JA0y7bn/98cDsf62QLYZK6rFX7MgJtaKVz9RqQMeMGxHDoIY1b7+PL7smn ZYjw== X-Gm-Message-State: AOAM5313DTAkxYJxgKgnRrer5cfG70h+lEBAOa22Xf9IMavRTIXH8o6b Qx0L8fcnNc9ytUdJ+9yRR/iT+3/nnRzzVg== X-Google-Smtp-Source: ABdhPJzqRD/1COz0wfFbQYvgycVPwRKq9C3FUKEuTk5axjE/l9VKeKdfAkaDIsEF2uTfmpbX1CNQ4Q== X-Received: by 2002:a17:902:eb85:b0:167:987e:2686 with SMTP id q5-20020a170902eb8500b00167987e2686mr14360987plg.33.1654806548944; Thu, 09 Jun 2022 13:29:08 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 07/23] target/arm: Move exception_bkpt_insn to debug_helper.c Date: Thu, 9 Jun 2022 13:28:45 -0700 Message-Id: <20220609202901.1177572-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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: 1654807343213100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 97c8c9ec77..2a8bdc2cbf 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -399,35 +399,6 @@ void HELPER(exception_with_syndrome)(CPUARMState *env,= uint32_t excp, raise_exception(env, excp, 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 Sat May 18 14:01:37 2024 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=1654808574; cv=none; d=zohomail.com; s=zohoarc; b=mQythPVAtwfXUeBO9A9U98iwuYJJiDpQamXIDc+6fGFP0XOzNTiYTKZqFP49CQuxcnWzD534sTWxBi4RpULA/kBBfsLZuD5ETZSUR+UjizmEuGCs585eDs2M8T2ICzg5jyngN5wOQlNeZPgdL7GgqRMpzWOdetRKDihz2SXzRGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808574; 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=BCzxefNxcQpSTLu01BysmYqWqiN0wU9rTXU9xeYcYo4=; b=EruVfRAVNN+Ad8KYalSo4CUW88WJ2IwnihojOgWz8VS41t7KWzr/WWOnQiHUd6D8BMv7w5kxPNTQabylVl65PjmerIMsbo+FhAHpjM/0Uw/wcGr68Ve3EJnBKtTqRgtBGSK5ikjcaYIxMCanhzr/lqBJTEqPErZyCHGp7GI6fGA= 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 1654808574601274.2255262432493; Thu, 9 Jun 2022 14:02:54 -0700 (PDT) Received: from localhost ([::1]:54922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPIq-00061v-GG for importer@patchew.org; Thu, 09 Jun 2022 17:02:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmH-0003hI-08 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:13 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:46701) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmF-0008Sc-8W for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:12 -0400 Received: by mail-pl1-x62f.google.com with SMTP id d13so5474678plh.13 for ; Thu, 09 Jun 2022 13:29:10 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:09 -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=BCzxefNxcQpSTLu01BysmYqWqiN0wU9rTXU9xeYcYo4=; b=I0oSIx0klTiW3S4pgqntyDI0vnJqmBCJfakF7r0jgq2+dVNp9oQWP8l5oLBMNtXWrh 544RdYEnW0eOJxadDliU16Ib4J8GDV9y1NJ+lXi2lkhjdBkTLDuOMoi4eyJSz0jdGEuR wq8z7CJuKzuZmgOtr/cblqG5z/IPzckzPG2oAImTIl+rXG97MsovcpU6XkjyFS0poiXH gzLrigs05uAZD5LbxxhhxIw9idKtRDVX3qdWpZBg2wOliSRZ33F/gMNV8qttAkE1pnTE ertdmkg6fHo8mmhYE5DZRICiWPtslOXqLmRA9GURK16I9LtLFxfaHXnXkrDi30KCCUk0 jE9Q== 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=BCzxefNxcQpSTLu01BysmYqWqiN0wU9rTXU9xeYcYo4=; b=pyOdW/X5QD3QWWg/djGRT0vkEb2U4hlQXYzx5EbFwZ4gH9ouZuuFfiZGQjrlEEXUSc ij+UO4yglLMRX1sZGzar/amQYd9XxmlypwYhbA8G/LRmcDqp0BdqCLx+7e5AETGuVDJ3 In9JzksXxwP70rCrELNMvp96y8LFfFGSD6R/pr+Zklk4BxUEmZlZn+wfsJ8MSBQasqX+ 0nz2l3rs0Qv6B/kmxlAsKDfFtjoK3f1ancqrZIGc54bw1UtHg32ZEoMRGdM0Nkqa1j2a hc5c4O0hAnZreiVEAajTFD2Cuh6aHnqDwOq8Ni+psXZxaecXi0AjoXm+mVPEtkgHMC75 o+Ug== X-Gm-Message-State: AOAM533ATAFy1hFxFGrnAE2BP0ABagvgiwGSTc8Mm+BoCMkyhcm1ZIpN kI0D+LFb6LHHzPXowiUA99moyn4ZA9T74A== X-Google-Smtp-Source: ABdhPJzPXKskCwkyYJHxjRMMAXvUqgNeAhOdEUXUghZamq6OFMrJpEeY3fJSh97Z7Zaoz2p0ZRPUrA== X-Received: by 2002:a17:902:c945:b0:163:c3c3:aff8 with SMTP id i5-20020a170902c94500b00163c3c3aff8mr41494569pla.56.1654806549951; Thu, 09 Jun 2022 13:29:09 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 08/23] target/arm: Move arm_debug_exception_fsr to debug_helper.c Date: Thu, 9 Jun 2022 13:28:46 -0700 Message-Id: <20220609202901.1177572-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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: 1654808575221100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 02fa70f75a..6f94f3019d 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 Sat May 18 14:01:37 2024 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=1654807499; cv=none; d=zohomail.com; s=zohoarc; b=AHGZ9C67meJLrKeTNQN/I94jF2NXBiHhJo0s9bAWOUUBcl/ZiIUtKrmO37oUqe6lkE2jxRQeYTjk69DniUOmzEb5o85U+IJKPBcDvP1fuBpju8TlYvkazT6VNP32ww06/0Ee6Av19clFR2ykKJKUYxUV4BWe02++tGTiP6Y5/yE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807499; 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=pnz9a4ifMBmrgWuB+Ns8XkcntMH3zG5QAm9o9NexRzw=; b=mMl0Rhe8cGzJAgGhYE3BGfWESwfQnwP4zfeMArpvo6xSh/IUKNqwQ2L1CYI/VymkXqtjAesmWv+iEfmr6A/VVuYhzkh1ZcQdVtQoTzKn3dS263S//+gvI6SD8y3pJxMaDL2323XqOQiXY1p2MNSyMgK7ssKa4js3NX0XwbX8RqA= 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 1654807499870911.3312602126502; Thu, 9 Jun 2022 13:44:59 -0700 (PDT) Received: from localhost ([::1]:58176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzP1W-0003ib-C4 for importer@patchew.org; Thu, 09 Jun 2022 16:44:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmI-0003l4-AS for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:14 -0400 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]:41909) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmG-0008T1-2p for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:14 -0400 Received: by mail-pg1-x52d.google.com with SMTP id e66so22844136pgc.8 for ; Thu, 09 Jun 2022 13:29:11 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:10 -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=pnz9a4ifMBmrgWuB+Ns8XkcntMH3zG5QAm9o9NexRzw=; b=WM2AoqcEJdtWYngdczBIID4zICHCxPkQ8QWK5qGvtYkTIIi8vDTq8xG8mQka/cBSlU BhPGyuGnUdF6d5uPMBOLWG0fuRRp2lw+EoDg19mjrU1SzQrYzG6aN1LpBBDFpY93FPRB Po9ew610WYNyjZ3DKw+mlLgRWR1JLQlpcVfI0hthza2zKG0lYIMAfWpEYU+eOhFJJ4Yk 0RrdlzKosJiwedsoqtyczLsSsnk11mvO8bvo+4i6Bccn5/yKahZSYsIQ7tBL7+zmHWbt 60Rw4tnx+a2LSVxPLC6iKeVtD0+a3/nuhNoX2rZsAFOO3ByExRn7cv0pchhF5RG5W6XF HUOQ== 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=pnz9a4ifMBmrgWuB+Ns8XkcntMH3zG5QAm9o9NexRzw=; b=BtQ+Zjo5yeIwrkG+xmS65qeott3yydJ4C9WkuCFgmX6PWStyE/OaT5az3EhosX70E7 NThAtUfd74o1pE5WNPwPEKwRhYu0JEmJE4LqXY6VpRLhZjxJ0EysAHRc+GYuMz1eF/lw IJRY/e78outm1UluemiJKm7AK1Hm7V5/5ace9KefWCMxJNv6D0F8eZvKc83BtpL9S+au 5zQlzCREoVtnqRAaBN5/BqKDoZKx0Zp/pvM8yKjWPhRcyKUd4RiHcoLaKLMu30d+ERAa v8497diCD5jRnQBN6vzOx1Q69gIGfNEJl6caSYfpLluHwG+mEAQfCWKLhSrdxousW9Sw eFEg== X-Gm-Message-State: AOAM532kp3GCvZ/dlss8tZG7XruXCFjJ891IEIYOvMRUV4UmwLyJnKM4 XVWgsDkz/nd68rqGOIXFfzSLKWtPmtQtBg== X-Google-Smtp-Source: ABdhPJwdZiTWaaOIIutypEtyIJzUOrOgNaXLl6UzBE6HYRnsoI9r5RsV9Qv3bz6bNZdWvIFUc5aUXw== X-Received: by 2002:a63:8b4b:0:b0:3fc:ee1a:9574 with SMTP id j72-20020a638b4b000000b003fcee1a9574mr34365519pge.431.1654806550771; Thu, 09 Jun 2022 13:29:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 09/23] target/arm: Rename helper_exception_with_syndrome Date: Thu, 9 Jun 2022 13:28:47 -0700 Message-Id: <20220609202901.1177572-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::52d; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52d.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: 1654807502134100001 Content-Type: text/plain; charset="utf-8" Rename to helper_exception_with_syndrome_el, to emphasize that the target el is a parameter. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 5161cdf73d..5a6802e3fa 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_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 f473a21ed4..c57830126b 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 /* Generate an architectural singlestep exception */ diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 2a8bdc2cbf..8a6a3b8551 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -381,7 +381,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) { @@ -393,8 +393,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 Sat May 18 14:01:37 2024 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=1654807995; cv=none; d=zohomail.com; s=zohoarc; b=Bjli0NbintPMXAbUHVB7DXRXa0X04TpVVtKXTiqIByQ+YSK9Lq1XHIbhu1nwKpbB9w+jmsILs1VveojEkspu1L5sPQF2yTznLJtnMLklVNHXoBW6rrM6/UYpx34uoaP51yDlCvydaGUj6QkAw7Bn7wFNR/KDFHDCYQ6RyaLhVyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807995; 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=kDOWLCpGVLLdjCKXH6PsNmxsJeThW1Pjgc0CFkMFbWw=; b=eDxDeeaB/fgtGCdXx6iiZFSH7tztz7hnW29HGnhqVt/1OlXfNvPbhKuFZGgKQX+tFN9HV4cWW0sPrD5xJnagwbHVbjiT12QdhS7LI6sKkYik3pNhT4N7mevTHyTvJBhvLf6BSYTb48sECfMPhbImqWGT2tLS86es2EGWDJK8Pnw= 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 1654807995429626.6231145003796; Thu, 9 Jun 2022 13:53:15 -0700 (PDT) Received: from localhost ([::1]:39964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzP9W-00038o-CC for importer@patchew.org; Thu, 09 Jun 2022 16:53:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmM-0003uu-V5 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:18 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:39649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmH-0008TY-1A for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:18 -0400 Received: by mail-pg1-x534.google.com with SMTP id q140so7805465pgq.6 for ; Thu, 09 Jun 2022 13:29:12 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:11 -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=kDOWLCpGVLLdjCKXH6PsNmxsJeThW1Pjgc0CFkMFbWw=; b=nnhX+QxLssQskHldmsxbJZFqx+lkz84X5rZ1vOBOHQ2pjDJiFiWZellsTVExZMobHk cDXOR5ik8Z4Z3clh027+HkNEvg2mAsd9qtqynm0T+IIOIZwDB05/99hPJx+ZpAAjwLAg fd+7RyzvvuUlVZE2YCrnZmJnKmOLIPPM8Aqrn7xKp7yA571Hi4At7YvATcQNMUNqxs9P NGbsYjuFwPxWJTmd2ztVzTRqovfPIrGNlvFmUhhogeAw4mxmIyiWs82hqxgLzx+E07AB sahLkbACYeuB6wroh6nY2XUaP2P96IEvfZvuQvrbmTVWpnaU/aEYP0XlkLdVgWg190p2 cMqw== 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=kDOWLCpGVLLdjCKXH6PsNmxsJeThW1Pjgc0CFkMFbWw=; b=vu0ts8BcXQ9P098U/xNfklWysTrbCuH0z3vafCJ5auuni7371NkO8a+sze4v8IzGHx 0RYfZclM4KjTOBJU67cyio9E9Z8Vkm06aP3ec9nVGpJUvgAJ2MUZdTxZApBQ6wrp4Nwv M0KzcLvjkL6wfPwbODRsNJKeVjc5HociOvwgfLfFi/FYsyHEx3qPnKW5j6qG9ecWcul+ 3P2FmDXM6pfft2DnPES9Xa4t50+aQzWIf1pNgZcCGEiv3VshRxmE90spiEUfgg2jDdFd ZyW0ml77h8gLq4imNUMaOQhvKpJ3T4NczreFuJ/478sSC2QAOXJ9dGUzVIzubwU/8sU9 nosg== X-Gm-Message-State: AOAM530hg7PXP75X7GVVawLC2zjaJqUS3F7njFXZuUC3nrTWnC8fLyed dyCn3xlgFVrYlRJtVhDCw6oqVEIP+iVifw== X-Google-Smtp-Source: ABdhPJwhswmxSNy0WYbI81Clkz+OaUCLFjpXJx88Pnhk97uBelV3xb8VxO2AvS6O8hVyq9x5ROElFA== X-Received: by 2002:a65:4304:0:b0:3fb:9303:de99 with SMTP id j4-20020a654304000000b003fb9303de99mr37063178pgq.429.1654806551500; Thu, 09 Jun 2022 13:29:11 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 10/23] target/arm: Introduce gen_exception_insn_el_v Date: Thu, 9 Jun 2022 13:28:48 -0700 Message-Id: <20220609202901.1177572-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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: 1654807996557100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 Sat May 18 14:01:37 2024 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=1654807967; cv=none; d=zohomail.com; s=zohoarc; b=k7qfLR70DltbXswxDXhocexhzHuE6wZw2uAbsFw/VpxJfw+2KxlwUgSHkimdXpdmFThV7x/n0+Gk8mn45XqIRVLCz1sLEH+fFkwVj+amYHT/h1GdRvBP9y+67I9qbcm0/P7x4ekGbwnX7K/hFKXCovQLbY1veVzyP16hOHdZrJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807967; 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=9MAUNs6V4mRPp9A90sOBEHx7YdKEYigB5XZ+QV7oJR0=; b=OjFO+eH5HzerzFh0o5vmUBpeRcW6cPbEy7yTNeJkhbR0ZH+xsVAYvqu993h9/ySLEjG3xwbyqqmK5UAEse5Xd+Nx2K8j8uHJPt3OZuzq6DYVugLRhxjk8J8i7ExJOPHMIsga6H6XkfXUQzu4D2kP+DJ9lxecl2EUJHKhiwBmQjc= 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 165480796725177.10345406618637; Thu, 9 Jun 2022 13:52:47 -0700 (PDT) Received: from localhost ([::1]:38556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzP93-000244-Gp for importer@patchew.org; Thu, 09 Jun 2022 16:52:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmO-0003y3-4X for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:20 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:50719) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmI-0008QY-BP for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:19 -0400 Received: by mail-pj1-x1031.google.com with SMTP id e24so22355680pjt.0 for ; Thu, 09 Jun 2022 13:29:12 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:11 -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=9MAUNs6V4mRPp9A90sOBEHx7YdKEYigB5XZ+QV7oJR0=; b=dLa6MlYhZeV6cRwT7o9InFiViK/vfkYlHjeoV+RxGDsrW13IFLgNBbVEVV6FM4m9Z4 jQxwpVwwY3XtN2FvBrIyOpdMwtIuojJtPZFzXr7q+7oFOqcPR/VeH7wU8iT/XBd6K9ZC +MFlr9hzThkg8ZyCkdEpr9DXuD3DAXhszH9NFSjn3Atwrdu+YaEzOJStQdhuKLq8QGc0 sYpDXLxZttmg86uVBlzrfud3w+99d9okQq3z12UNrxuEOTeQQDDEvBmfULOIsMts8l5O oB7Z/MGRqHp582OyaggHZA2FORdT6QdMLEzydN2bxKVl05wFA+UYN2CfnYA3BLs8eAsh lskA== 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=9MAUNs6V4mRPp9A90sOBEHx7YdKEYigB5XZ+QV7oJR0=; b=5YgHwW4uKYibhpzs/UkELEPSo3HtKoxauSEhtyiEOpT2SDTS/lN1A5TedsQWKKZIJ8 SkhC+vqsvgoPxguiwt8R2CShih2XB/VwPPpEoGJUh3CTMR2lI+K7SRsXJ5v/khcU8fjE SWbvvCr6340teNyIyVr5TwblHIuL1ab1iO7EAXV34rbJDDCjKMZ8HuEOvms9bBKVbXqf VxZc4IWOrxLi0JBfmIcIEhZ5UiSAYJYtpZCiRbbQdGOBivogEuuzBx410XH0siBBVonS NyETbxUAq5mPTohTwDRu4M/YVGTmLiKCiIyD65f89wHwhDIHx1QvqiP9s3C0si0ZoVP2 B2XQ== X-Gm-Message-State: AOAM531aq45FP2EPQDdOQX89FFQ8BhTQf7I2raMgdt2eLsHUXds7i8dd amQMtzJyFo0vza2RNT+0DLzLfT2ZcnG91w== X-Google-Smtp-Source: ABdhPJx+afm2KENFvHWU0Wqvj9thS9L40bKs9j18AKkgKRmzOucNHvl5PwX/LHCIdj1FHMB/7+0Crw== X-Received: by 2002:a17:90b:3907:b0:1e8:57f9:dadb with SMTP id ob7-20020a17090b390700b001e857f9dadbmr5023014pjb.137.1654806552237; Thu, 09 Jun 2022 13:29:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 11/23] target/arm: Rename gen_exception_insn to gen_exception_insn_el Date: Thu, 9 Jun 2022 13:28:49 -0700 Message-Id: <20220609202901.1177572-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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=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: 1654807968607100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate.h | 4 ++-- target/arm/translate-a64.c | 36 ++++++++++++++++---------------- target/arm/translate-m-nocp.c | 16 +++++++------- target/arm/translate-mve.c | 4 ++-- target/arm/translate-vfp.c | 6 +++--- target/arm/translate.c | 39 ++++++++++++++++++----------------- 6 files changed, 53 insertions(+), 52 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index c57830126b..9ae76535ad 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 e752589090..14bc80dba0 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1161,9 +1161,9 @@ 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_exception_insn_el(s, s->pc_curr, EXCP_UDEF, + syn_fp_access_trap(1, 0xe, false, 0), + s->fp_excp_el); return false; } s->fp_access_checked =3D true; @@ -1179,8 +1179,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; @@ -1816,8 +1816,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 @@ -2069,8 +2069,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) { @@ -2083,8 +2083,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) { @@ -2094,8 +2094,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); @@ -14725,8 +14725,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 @@ -14757,9 +14757,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 0f797c56fd..82fdbcae53 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -230,7 +230,7 @@ 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_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn, s->fp_excp_el= ); return false; } =20 @@ -260,8 +260,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 Sat May 18 14:01:37 2024 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=1654808294; cv=none; d=zohomail.com; s=zohoarc; b=DL6+eAZti7bAkkxi/qluH1f33+sHrjfLHRt1Q7EpxzDhLlwo5kcLJzrhvbsWv57SAEm6zh/ET0IJjwdQF2B4FQeJHXd/PiLAz31xOTzvZhGKuv/mSI6vb+OJ+nXmoGfvdOp1xD1a9iRBzb7u57gyxyGm3anMt0YZgDAqWP3tuaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808294; 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=UBq9cvT3mNZnwBfSHCh8l7KhDANOXMY80ZzRcK7glgg=; b=HbBwDkkB66Hh/zYLqnVGj/oAoIWUHReHuJ2TaiQbztgEzmyPrUmNvsEpX4jANKBXe4ftOsdGixVuME6bN5lClaDFGA7t0EkXARGBnxUHJZke9pEqyxrEH424EuO0vQvrIwM3zA12M/LBubQz9Iv6ZYQIaSs0mt6L925lWkSAYWY= 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 1654808294495316.4439623584177; Thu, 9 Jun 2022 13:58:14 -0700 (PDT) Received: from localhost ([::1]:47936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPEK-0000tR-Nf for importer@patchew.org; Thu, 09 Jun 2022 16:58:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmN-0003v2-49 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:19 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:41737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmH-0008Pt-VZ for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:18 -0400 Received: by mail-pf1-x432.google.com with SMTP id p8so22038910pfh.8 for ; Thu, 09 Jun 2022 13:29:13 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:12 -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=UBq9cvT3mNZnwBfSHCh8l7KhDANOXMY80ZzRcK7glgg=; b=RnxSB7KiSM+3qgtygFaek4KN9uWfeehJtibSdVBd2kUSANq1xup4UTo3iqDtbpNlIE TzEUz83FooTGNSHC+jWZbZX34JvjhhObodK1frI8lu7v2+PyOyJ2QTT3E6eiP6DtLX+W q+mKglYfv/JOeVK6dvTPEkAGFoC1Fc/AXd5MZkJs7f3LBZ/c6yTSOTNUwSQPTclp+kO/ JyavuVGI3txUZ7AZ3rCU3i6ITYNN3G4tvSr0deuVjRyvvq51irwVCd/jopmNAe6WCFSV X6ZHtd+1BdBQV0BVnegYIuVWW72n4X5xOFjp3zbRJObxBEXkUc2RjpyWYpXvb8sVkbQy dQSA== 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=UBq9cvT3mNZnwBfSHCh8l7KhDANOXMY80ZzRcK7glgg=; b=5i9zA5k0WsuCVHwCPk6GmfF+X7xaijsXl23o9mR/PF42hz8KNwpohRf6MkUSZPS3ZL Bq0T0HOuyRR1JS8kneTwyerTKu4HnS2mu4MfK2SMB7GL0iPLysA4I2S2rC3xk4ie1m9i 5JmO+/IhjPr6TT2NKNSHcYTUGwxVN+lKxwYd1lv+KaPPecQxyVKCiNpYEN/ewQKBag5H PYR9iAEE22cMAYyyIMsY8MgOk5kxU1kABBID6jkElKd6+x2f/aecpFnXx5umtroJZ29z 7ZGvAOEAc0uafqC7skb+yeoCI210iCIg04UEHYfqvgamm+L8n22OMlBlWv+2QSlPaVwJ RoYA== X-Gm-Message-State: AOAM532JRLicKHKkeZsT8JvJEozmi+jTawsvSWks71LM4W+mQYj2bUUi uy7Y6JZZJW+sCP40DWKvIEzyWwdZ1AkQSg== X-Google-Smtp-Source: ABdhPJzRKmsU/nP5ZWlwNdQWEG/xU6spOqlJTUizifp9fiCtEJLuxakSDFHEU14YsUFbaI1RyDMN+g== X-Received: by 2002:a63:8b4b:0:b0:3fc:ea73:db40 with SMTP id j72-20020a638b4b000000b003fcea73db40mr33788087pge.399.1654806553140; Thu, 09 Jun 2022 13:29:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 12/23] target/arm: Introduce gen_exception_insn Date: Thu, 9 Jun 2022 13:28:50 -0700 Message-Id: <20220609202901.1177572-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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: 1654808295788100001 Content-Type: text/plain; charset="utf-8" Create a new wrapper function that passes the default exception target to gen_exception_insn_el. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 9ae76535ad..4575af6e1c 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 14bc80dba0..0581118f56 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1816,8 +1816,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 @@ -2069,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_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) { @@ -14725,8 +14724,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 @@ -14757,9 +14755,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 Sat May 18 14:01:37 2024 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=1654807385; cv=none; d=zohomail.com; s=zohoarc; b=ld1qw7vmMqqUOjTgXdpNE22514+XNsvToLGUASsLwOL7mJpmt5o6t/1gl07ymd3u2c+8qziZWZN98hFHq+9AxxuPU9um06PZ0eM8bdCzEhd/6tjQ/0p+xKVtEpNLScSK9JZl2MMlumZH9oBIFYCLucVdUWddrzt3u2WYJLoegoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654807385; 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=0+1B/GKcGEn9X9Wh/vHToPB3bf3Gcg47/xOcf+MkVK4=; b=OUp3ux75+S0pMb3XfMrLi3IN/S7yIYDBv14zI+8ICxXgsx7CI9aVBFxLem594PnT73nABmH653tp8P/D9AhyUIg5BKgW0ubzoV3nY+5iZF5lb28KjOFo+lcBm9P+mnx3odfO9bazf88EDb+85KdZHZ98U56QE9QBOiINCvuFYIk= 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 1654807385627774.9536874229444; Thu, 9 Jun 2022 13:43:05 -0700 (PDT) Received: from localhost ([::1]:56070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzOza-0002IK-DG for importer@patchew.org; Thu, 09 Jun 2022 16:42:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmO-0003zF-HA for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:20 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:56094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmJ-0008Ux-Ad for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:20 -0400 Received: by mail-pj1-x1032.google.com with SMTP id e9so11776340pju.5 for ; Thu, 09 Jun 2022 13:29:14 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:13 -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=0+1B/GKcGEn9X9Wh/vHToPB3bf3Gcg47/xOcf+MkVK4=; b=k+ly7rWsmjvspi/PxfIQPbs7w5Q1elL8Dw0+KZmqiAZ1gnoUT4S/7BbUosoK8MPKB2 IjLtEGToeLRJ1Loc3G8eVnf5I/iqqe+Xr9PE+JxrKk/0B5V2vAW5i3G95GaSPv5Pf12H OdjxJ/QnxDMUfXDYOY3Gs1lTVRWeh5mSfHhFM1ERuQsfpEK2L8ssyFeLcXTVYQSl3Yec kerD0oxFp4iwikJ3+hOqjodq5WkRyyivqGnblXNXInHMGxFHjzJnxOmhHOvj2e629edp FZMXrFlgtOdkSO2sbJBE1zRHPLn3QZxVLoghxjo2rLkTEXZ8wzzmCTFGoeGMedDSPpdY QLTw== 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=0+1B/GKcGEn9X9Wh/vHToPB3bf3Gcg47/xOcf+MkVK4=; b=8I0/QBhrOsGSQ+4WRgc3kqZxKYpm1ZdMzY+fC3xYJNebMPXbgGgARUHA6Bn1Gzx8Dt 0gH8upHLG9xsORRK2o6oCD2k3Ol7X2W3nakyWfadF/5vpl/dqzeLLA7MX2ls2f4ouiaS 0XruLEJGtZ4uyuNPLpdke9YNFh2j4FZ4fmM/a6/kFB2L/TTitO/FI9b92WXSGXO1ke4g TvyoPxO0rlNfq5ZgPLmiYfppboaClk/FOtUwcYlweq5tB76szNRfOpTEKqV89E1ZL6o3 bw99uEE6ftu/xCmasgXIn1lw1h7LWZ/LoDSkuw0O0ysBpCkvGqqrjGKdgwG6Mr/KE7fL e3tQ== X-Gm-Message-State: AOAM530I7+Jjw8qOnftRsDhm57nI3yAcscITOv4Ol5LnstoojyN8a6Yw 1JJTq2zHAS9140UYbxh0lSkj/lGeUyel5w== X-Google-Smtp-Source: ABdhPJxtdeCZeypNz/6HboRYNJ4/TSl9AMEpJHTWNyAeASIiHoTljAZi9oOc1ZTfITe77NaGsYUAyA== X-Received: by 2002:a17:90b:2246:b0:1e8:5531:5e61 with SMTP id hk6-20020a17090b224600b001e855315e61mr5031073pjb.86.1654806553943; Thu, 09 Jun 2022 13:29:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 13/23] target/arm: Create helper_exception_swstep Date: Thu, 9 Jun 2022 13:28:51 -0700 Message-Id: <20220609202901.1177572-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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: 1654807387510100001 Content-Type: text/plain; charset="utf-8" Move the computation from gen_swstep_exception into a helper. This fixes a bug when: - MDSCR_EL1.KDE =3D=3D 1 to enable debug exceptions within EL_D itself - we singlestep an ERET from EL_D to some lower EL Previously we were computing 'same el' based on the EL which executed the ERET instruction, whereas it ought to be computed based on the EL to which ERET returned. This happens naturally with the new helper, which runs after EL has been changed. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 5a6802e3fa..db7447d233 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -47,6 +47,7 @@ DEF_HELPER_FLAGS_3(sel_flags, TCG_CALL_NO_RWG_SE, DEF_HELPER_2(exception_internal, noreturn, env, i32) DEF_HELPER_4(exception_with_syndrome_el, noreturn, env, i32, 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 4575af6e1c..890e73194c 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -341,15 +341,9 @@ static inline void gen_exception(int excp, uint32_t sy= ndrome, /* 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 Sat May 18 14:01:37 2024 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=1654808296; cv=none; d=zohomail.com; s=zohoarc; b=nxjZkQA8K5LyUgjZ1DxGHlKPBNHWrHp/dZem33p6WbOX6QVdUpjCG1BnXBmdomTzeFrNB+AaDH1o8k5t0AyWrhLS4z9RxNYb6+qxOEbOB/JU9WXy/exeAPEa3DUh0vsKQIshD2r3lgnpE0zGcUPOslQ310aU4pNfdTt7QkxG8Hg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808296; 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=X4QBEGoTbGLTN/ILF22bIhYsyh/MJrjgKuORCxmlFdc=; b=MvwbEpu4T+frJMaAzEnELnUNQI/DJK5U9aHMbIVGtLBdIcJCb74ha6dM399yV/AiZzalm+F0zq9/ABjVc2JFgpmFLPF5Go/QWr1rsg7PMCkaFbauTsAWe2fNwWp0ecTx/K7ni0Jn10ph27Chr0CdGeWLZ0egwXPo/IZNG4UR0h0= 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 1654808296858800.0625120877938; Thu, 9 Jun 2022 13:58:16 -0700 (PDT) Received: from localhost ([::1]:48060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPEM-00010e-Bc for importer@patchew.org; Thu, 09 Jun 2022 16:58:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmP-00043u-LU for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:21 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:38494) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmK-0008VG-K2 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:21 -0400 Received: by mail-pf1-x434.google.com with SMTP id e11so22035763pfj.5 for ; Thu, 09 Jun 2022 13:29:16 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:14 -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=X4QBEGoTbGLTN/ILF22bIhYsyh/MJrjgKuORCxmlFdc=; b=WpcdIk92897aqlL+QJ8D4HvktLBSHenC7sw/M+jy8ce+Kro0tWHBy6qwiLeMCQ71me ExaL7Z2kJLca8PSiAqc4D4UXJcyFNoVSyu2UgZLQK+Z5YHGoVr2xXj9IuC5PJwEvpVWs pjas3C0Sqa/G8EBW2fmTQblQOY9Zec+HaFtBlaWVvr2nPq7+cEaQNDYoK04TRWCJ5X9R BmpUbNSV8rrmS4ly9bGTbWj/Qj3ON4CV3HIDDeXGqrLMzy2Y3twMg+nYIqnsQh+TcEN5 fza9cs8G35FLjrwixqyFUCb8pJaos+DRA3xrX9bL8V/34I0UUGLS/BOIMf6E4Z0RxqWj rIvw== 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=X4QBEGoTbGLTN/ILF22bIhYsyh/MJrjgKuORCxmlFdc=; b=cxmra3N7aq9jPQIQXq0Ap2YIsLZ+189prudI6fYE522lNb5wrMxebaiNwlGZAwVCqC FfwxBf8jqKL76F3xlwM5r7x79CweK13LPELhXeqew3oBAp47DZIoyJXgJwt5QyS3wrCI s2wkxoLJan4qK21euSOdB8R80fh22FMk/ChyITvAEkvACoigkwdf/l8kJtOcijGURopH LhSVjpTuTTubxwsArYp1Gar80/X1YoFkNtiR4VuipSC1sk6zR+lJQeIUVAg7tCHQAEv1 QkG1IGhi4mtKEI5AfT/14Uw3I0+nkKkwAYALs7pqEd6036Z7xicRAGO0yR6wVV4npW0g KBDA== X-Gm-Message-State: AOAM533SyJLtv5G4A0WLTjIksmD0dhupPZCDwh4UONNOPMj0gR1rBpqR MeeAZJrid7Ka0kYOr7ptnkkJrLy4S6sqSQ== X-Google-Smtp-Source: ABdhPJwaaNiuLbXDaYZHBvY2XpH+4bbW9PwJOdm575R/YdabdqwBEe+aGuXliYoJDfSMucbeG0m3Nw== X-Received: by 2002:a63:8449:0:b0:3fc:85a5:5b69 with SMTP id k70-20020a638449000000b003fc85a55b69mr35876418pgd.261.1654806555201; Thu, 09 Jun 2022 13:29:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 14/23] target/arm: Remove TBFLAG_ANY.DEBUG_TARGET_EL Date: Thu, 9 Jun 2022 13:28:52 -0700 Message-Id: <20220609202901.1177572-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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=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: 1654808297524100003 Content-Type: text/plain; charset="utf-8" We no longer need this value during translation, as it is now handled within the helpers. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 50b5a9c9fd..719613ad9e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3104,11 +3104,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 890e73194c..8685f55e80 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 ac9942d750..2b2c1998fd 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11102,18 +11102,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) { @@ -11139,7 +11131,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 0581118f56..4f6181a548 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14645,7 +14645,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 Sat May 18 14:01:37 2024 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=1654809136; cv=none; d=zohomail.com; s=zohoarc; b=UJ+nTf0K3qwoL6m2u51fYPqm6KNk7BPW1/RelxrO9Ys2IbftslKJsy3+AW1o/acefcO5LshklXrXZ5m5IfTHDUYvu8+x3LPGdrLnlnAzxX+cuSCOM0gDTgDErCR4vD7iSSl/TD18xp7LG+3qf7mBIRiBbfTCjRLOR9zQWL0GqwM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654809136; 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=+8pdwGU+0yoxMh5SE6yAGZhMV/fFIOLe/XYFBrqv9Rs=; b=nWqFfEbuk7zSQO/m1HIZNlb0adRetdhf2MeTD9yZbjy/8TEfbRCh3RFNLCQ9HOS6WXp4mSwSFU7UYjdiWWUd1dKblA8MgdCA7ibaxzCgQ/N6CNp6M4guXulbB9uBKdibxZ9H7GPKYx/b1v8h2HQ7SGFp5Jrp4xCEe7ADqwhMoQw= 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 1654809136039478.3481496800814; Thu, 9 Jun 2022 14:12:16 -0700 (PDT) Received: from localhost ([::1]:42314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPRu-0000D1-SJ for importer@patchew.org; Thu, 09 Jun 2022 17:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmP-00044h-TH for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:21 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:45692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmM-0008VU-FW for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:21 -0400 Received: by mail-pj1-x1031.google.com with SMTP id w2-20020a17090ac98200b001e0519fe5a8so348855pjt.4 for ; Thu, 09 Jun 2022 13:29:17 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:15 -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=+8pdwGU+0yoxMh5SE6yAGZhMV/fFIOLe/XYFBrqv9Rs=; b=oPgPlJlfZjbUYgZUzozivO2NeLRXciIzuAJfreX47HhFV+CgH8xszk7voqY/AML7Ff eqiHt4D+PU1WZMVYJxxsHEvTROv0/UGeXrHvWqWU1TQPXPF7Ta0zVNS2JW2GlK8LNc7R 8bwULEGnsG69hUYEsIvG8JdxCQ9iJucWFiWUTCq+DxXX6niAgW39LiMa/qNS8pVgzdhV tKQLQf+wduDIqceqKdgVlUXwzJfiqBL9rsCsXyphPQEmpQRjQwbQb7tEEIDtd3dQdliT e2V969gKQ35lVw4HxZsI+t+0wASGw9JIvxpXx22sfdWT6OGxJivk7yfiOCb+CngZMt/v RT9g== 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=+8pdwGU+0yoxMh5SE6yAGZhMV/fFIOLe/XYFBrqv9Rs=; b=mQr/K+jOB0QLGKpchcpa7i7Itk2OjThb6oArlUSRxLRGwX+xt5agPHNq2fbWiaYrq7 nRxUzRWEyKlVno3XcE+EZM0ZXsOrIKpZZTg8TiVb8LDhahYgu4wTYYruIFTuMWzzmXp5 6e6NKlUSrnIu/99szYTan8oT0CuNdMzy/os3Yjzt+FqZBql5YiQhQ76c+nBTcfnJs+Sp bV3TQskd8F8NDvC2ZUaDlQ+alPDfiCYHmrTUNQBoFvxIfWmGu+vDqQShn7omf6uTH5cX Rw15dy3gTIrLi+vA0IVXtmO9bM/h5QBwNQctoflnJ5EteimiIo6mf2o0DiK9prXfqcsi 9/Ag== X-Gm-Message-State: AOAM532ntL9590+cK3OKXT6UDoWywq5jjT79rNd3cMs4YdL1Cur1bWqL O51tNWDs763nvNXVB8LZeKwerFBub6wMPA== X-Google-Smtp-Source: ABdhPJxQrWH+k+HQmd69HGK/9psWYiHdIiW1yDZ8KtXpEOLl/x71FH61nr/brV/hEAfgCabgRw5pPg== X-Received: by 2002:a17:902:b090:b0:167:7ae5:e13b with SMTP id p16-20020a170902b09000b001677ae5e13bmr22908263plr.170.1654806556009; Thu, 09 Jun 2022 13:29:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 15/23] target/arm: Move gen_exception to translate.c Date: Thu, 9 Jun 2022 13:28:53 -0700 Message-Id: <20220609202901.1177572-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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: 1654809138106100001 Content-Type: text/plain; charset="utf-8" This function is not required by any other translation file. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 8685f55e80..850bcdc155 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)); -} - /* Generate an architectural singlestep exception */ static inline void gen_swstep_exception(DisasContext *s, int isv, int ex) { 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 Sat May 18 14:01:37 2024 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=1654809576; cv=none; d=zohomail.com; s=zohoarc; b=M9uTc6gx98UetM/e9jUuAlco9Dk7ZpRcEz8+2tSweqVU3DZYids5BIdWPE0Mh9+kP5elcLSwnlDYQIlJ628LkmBW5rPZfoPMcPfS4epBSuq1gvWt0WY87YvwyA/AeIiT+6FuBnt7XTxGtQyWgPVzRaeTsyeQ9xGO7BImw1lrNX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654809576; 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=tkItDlBc/fej8rt3xUV6vGEsNdVvZUjvDsXBkPPMGQA=; b=BZC6GoNzn4pSxyFUjWiEgpDgiuDHHpkYSwmYctPRA0A9E8bCWWThe6Ld8dczGq1CmvuDBNth6szPfHBbnfVm58pUAZqf2Gs3YjNkKC7WIUDhC+GWmWeFSmyguYIdWW/Ua2iUmtsDbFG47JjVZ0sr30CEIfLbrUzSlGTlTgRck3E= 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 1654809576634755.7792371790605; Thu, 9 Jun 2022 14:19:36 -0700 (PDT) Received: from localhost ([::1]:52204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPZ0-0007gY-RS for importer@patchew.org; Thu, 09 Jun 2022 17:19:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmR-00048F-DM for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:23 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:39745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmN-0008Vg-Gp for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:23 -0400 Received: by mail-pj1-x102d.google.com with SMTP id q12-20020a17090a304c00b001e2d4fb0eb4so352588pjl.4 for ; Thu, 09 Jun 2022 13:29:19 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:16 -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=tkItDlBc/fej8rt3xUV6vGEsNdVvZUjvDsXBkPPMGQA=; b=I0CR6nhE9R69/brG+6Gi5BohVhQ2ktVzlSNVwXIaVoJv7jzCblref1KjLvAnsmXumH N7qljwrI06ykm2Y5eVIna4jOUWYg1d3cpwi3138hg35lC1O+hPIt6qjKVMMLjcD4lonh f120JpGSHJQkCCvATM0ZQkf59CG3nI9Z804BA01jG9BFNZutAvO/4af3D+xfTveHqXbH FzjCNMmKjgKBF0/LQyQvD1fuHPdC3aensF4LxNyqRVM+2JeczKId2YJpLLEBGMFOqhaf Ywp0uVbSGobSz/IotNJTgzyWqCoHQGyNA6ElwzXZAd6nfeHxaeSpgs/MFNTWxQh7sDn4 p37Q== 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=tkItDlBc/fej8rt3xUV6vGEsNdVvZUjvDsXBkPPMGQA=; b=PAJ5O+Toxw03Aw6JYKejcTdMPpaNu/m1SOTaTnVDWYrCtLXqiq/JpP8JaCFFp4HXO1 HDIyL2UCWbZAgyA0i9eC1Sp4z5JtREf6FZhWbQSVux3v9sbCIQMKvrUxWAcAnu7Fka/3 8YiXlIUG79+Yn4rfAbi+4yrkqNBJAYXvnxxeeGgyLC22mPU7/OzzZZ3aQP+A4czEmd8U c3SR83xSQ4gG1BINFBhbRYaWQ1k8KBEQMkPRyXyY14R3jctO0C6/EQfAWZ6vIJw7URSz 2lRg0jGj2D4z/DB8KRRWVuL42E0UldaxJV5rDwK8Ngtd8q1HLETVqTg0J2HirFcDcY6a onRg== X-Gm-Message-State: AOAM532Y6aw/9Lo91eLQ4vzkI2imWKjCQDGV8EgIjDqNaTyXb5smO0dD S6Hr4+D0D75pzf5OJPB2KfiBmvHpLI/MOg== X-Google-Smtp-Source: ABdhPJzpAqnVDJaoLS8xG5ab80KIbxB9kjB1QSHCj8Npbdv/WumGO4SYhJQpEEo584toCxK5H5WItQ== X-Received: by 2002:a17:902:d509:b0:167:6ed8:af9e with SMTP id b9-20020a170902d50900b001676ed8af9emr25901469plg.140.1654806556998; Thu, 09 Jun 2022 13:29:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 16/23] target/arm: Rename gen_exception to gen_exception_el Date: Thu, 9 Jun 2022 13:28:54 -0700 Message-Id: <20220609202901.1177572-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.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: 1654809577653100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 Sat May 18 14:01:37 2024 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=1654809753; cv=none; d=zohomail.com; s=zohoarc; b=AwYSbHGg7PVXBCjjEqZs94oqC4fHKjLSYjxVR2TgPOhLe4dvNpTL0fyR2TDPxfKNU6OmIa23Y0BuavavHhJpgJGg2DiT8HVNapN5yOG1yLqmvZGMO/VbH8bm9RlqUdvws8gOKzfa0QTH58B5vTwttyCmV5EJjHk4mMBxpjSZEDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654809753; 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=IeebmSLreQJnSlKwobDxcpS2nsd5xpcDMdcYwPgpEJM=; b=TVjWkCMrqzOHR0dRxATOzpkVoE555zgNQEeEJRGZaK8g+DsWzOcwY5pJqSyrYAiDv4kXqv/9GBV0ay6nS79eY0K5VIJG+lT7JaQj32c7sILGVGR0HffN3QBVxEouRljgD5jaWfoJNff0xsb5Cxfj6ftPpWSgu1JvpPz709g+Ses= 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 1654809753793235.75866300597124; Thu, 9 Jun 2022 14:22:33 -0700 (PDT) Received: from localhost ([::1]:57508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPbs-0003ia-78 for importer@patchew.org; Thu, 09 Jun 2022 17:22:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmS-0004Ah-Hp for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:24 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:35346) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmO-0008Vu-7O for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:24 -0400 Received: by mail-pj1-x102c.google.com with SMTP id o6-20020a17090a0a0600b001e2c6566046so405327pjo.0 for ; Thu, 09 Jun 2022 13:29:19 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:17 -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=IeebmSLreQJnSlKwobDxcpS2nsd5xpcDMdcYwPgpEJM=; b=whqkkro9cftREiAC8Mq2sut0YAw+cByAvKnVSeXwIx8imYxatRY0e3/HVk7Zz4Ypyc 4eCgEC9rwzBDfj9cjqPRaAadq+rI+7a7CHelTgzcz7K4z8wD17/VAZIxzUjxTi4xLugq f+bLx1Mr0yIf+diyj61NtgYsHer8Ay/dExFFxh62+ZaVk94BCjHmFRek80oA+Sdpmbq0 toYIgttzt1vg5J60kXwoTjLX4q9v2FUt4E6O3Nf+4fpSIITmJN60+H9W1TSlPrqN8bRe GgIzZfGBJ5s9OypYD0fmaWYVegTaGFVNhR4hY4upkt1OxgBNBWb1ACo+UE3yTY6kerTN o7YA== 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=IeebmSLreQJnSlKwobDxcpS2nsd5xpcDMdcYwPgpEJM=; b=edd5s7hIzb5cRLIzpF1OgKiXZyTZFp62zsEbDFrgbF8KoSpgy50jpAib2w8D9/N0YY TvemS9lDC1+X+0go2iTH1ACgCdIMbUD+6Mk8GhTEEbFBwKKvt5KT3yHyxvrVX0xOQPD1 JdSDGzqeGOoxQYtJIOK3Q5qiAYrDq1GM1AytOX5J4FwHJN8asNxhpukTfFxGTq7zVQ1E PohNegu9XyqvpYiiwWrwb29Fy4vYJzoKDVS/ROGWwI3zgGipgEbANnvRFRNHTlhUkc9Z 5vSt5FcqFbuoo4TYLjWu6ZpKRJ7IVSuD4VejMNY0RoXxrg43RWdo/I9/CXuSnqEiN/VJ 7J1A== X-Gm-Message-State: AOAM531HvUkUtiTNSVIBFDgy0RFT/z/gWoF7NKIcAXVT40ahsvnvfmWY B5PxdHKi0c1p+/lU1UHBcvmE99BpAKgTLA== X-Google-Smtp-Source: ABdhPJyxO/omPJgSMjIZY47Jh+y8wvEdMFyjL96fYt4DnRlCqNsLlNyAPSt11Q+qht7YDgTDTzUs2Q== X-Received: by 2002:a17:902:dac3:b0:164:13b2:4914 with SMTP id q3-20020a170902dac300b0016413b24914mr41271421plx.135.1654806557881; Thu, 09 Jun 2022 13:29:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 17/23] target/arm: Introduce gen_exception Date: Thu, 9 Jun 2022 13:28:55 -0700 Message-Id: <20220609202901.1177572-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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: 1654809754694100001 Content-Type: text/plain; charset="utf-8" Create a new wrapper function that passes the default exception target to gen_exception_el. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 Sat May 18 14:01:37 2024 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=1654809388; cv=none; d=zohomail.com; s=zohoarc; b=glzBqWxABk4nCXtqqrJXV/KO3EL+n8xRg5x5niqy8CR8Mnov6GNrTzQ/lPvd2J8UhfWmP32W2K9qr+wTQ3jU0AYyHzCi0Kr7MRH9OggF+YtExSq6LEXvhGV6ZbV/mJWu9koBUryux7nWhsd8rEP2stvH+jKoSWJ8oCscZAQhDIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654809388; 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=XrwBHtaJMwMweCtn22KfTI+wKyoZs8cSGLm5AgDVmqM=; b=WUD2jg7HLDKXSfMoTwIWcXTbQa0Cpldb3lpJyuOJlXQAluE0kcJgfmoyu8ZBjexHL0x0oWYjsTtPGpxln6bSYuV2qtgi/uFItJ7JU0DStVaotEMztIsjYy3wsZ1kOt3RI8av/AJVTZs0iUsje/rEx45fsUggsKoNgTuyTSHxpDQ= 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 1654809388632394.83733099193455; Thu, 9 Jun 2022 14:16:28 -0700 (PDT) Received: from localhost ([::1]:47918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPVz-0004bC-Dl for importer@patchew.org; Thu, 09 Jun 2022 17:16:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmR-00047e-6S for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:23 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]:52108) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmN-0008QZ-Fj for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:22 -0400 Received: by mail-pj1-x1035.google.com with SMTP id cx11so22331417pjb.1 for ; Thu, 09 Jun 2022 13:29:19 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:18 -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=XrwBHtaJMwMweCtn22KfTI+wKyoZs8cSGLm5AgDVmqM=; b=rG05RsYBVVZX4resqdsV4lWMMMoA/I6969GUg5VNcYfPayMV0AtXfIBQXQ1oYTQo+S P9XsKFcERVz+EgXSNN59wEeVFVlD8Z/YdJuBdxQkPg4+UbJHaT45PzOnWll++SAzbnz1 AMey7Dg2hRtvS4EceJ+f5Yf1r5YdG1pAyzKYfqzwDj/khhbOKu5jkhnkpUZmL6n0yNZx /4ksd/YlmA00oo45Izr1wZDsIOdKVDP0e23DR3fgHJ503IcRBoUCssvEsYPYQEVzLMgT qy0hATtMMzXs4d/jNOTsGUi+VtogncXLoz8XWNIOtQxvfn4UUn6XTdRDTUU/kRkD7CJY yeBQ== 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=XrwBHtaJMwMweCtn22KfTI+wKyoZs8cSGLm5AgDVmqM=; b=X/NsDTg9JmPip5qqZJ3+D9PUNeupdvRvcctx+uWHRfEkCHazZpV6WAJY0ZRkVuYkKF TrT+MGvzYIR2dTv5D8SRKdu04OowVd68rM2HLNcpwuAQOorQ+xnusOQByrl/gsa/sQC5 xIWb2iIterGXax1Q1Pf0xTfVRiZ8Wpwsc5F0ixGJz8XVlijzDFbYSqazWw9Lyom5NuxL FDxTZxplkyguL74zC7I1xhSdIwi/yvQbWn8FBVrBjgwp8AkKyscAJJPxnVe/Q7IejYFg R63sutrPtZCMCysdntjb1HzPjZk7T2jldmBSl0K56MfmsNt60Bx+ylzkmVsjit8k5gLu m8fA== X-Gm-Message-State: AOAM533aeR6q7dn8AkoeBCzmiisN9koIQ4b53SAUWcPzG5qNVnxbWGlX HVOWWCqNjnNOhxznVJC9q0VZ+k5Untotzg== X-Google-Smtp-Source: ABdhPJw7ApCQRkt73n6K6mJBKoXw5NOfnuEt65C6r2bRHwdFp7j0vrmFLGZ7eltNeWUFSJ3ynYS/qw== X-Received: by 2002:a17:903:22d0:b0:164:ec0:178c with SMTP id y16-20020a17090322d000b001640ec0178cmr42012398plg.127.1654806558676; Thu, 09 Jun 2022 13:29:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 18/23] target/arm: Introduce gen_exception_el_v Date: Thu, 9 Jun 2022 13:28:56 -0700 Message-Id: <20220609202901.1177572-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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: 1654809389519100001 Content-Type: text/plain; charset="utf-8" Split out a common helper function for gen_exception_el and gen_exception_insn_el_v. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 Sat May 18 14:01:37 2024 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=1654808707; cv=none; d=zohomail.com; s=zohoarc; b=N/dTEalXm+p40Z1v9wmhQHR7CSyiinCX68Rt+vxZ+RWLWJaCeqB9+K8Sc5j7jofgfhYouNWsqOnahdWeneKOqFrLk84n8EQDXXw7qlMXTAZdlG867Sac1aUPypSfrHEcIsQfZaKIGsx2Hc+9xv4R+nNZeeTix+ZT3fQ9pD/H7YI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808707; 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=DZfUsxzMa6ISMCnyMY5oUW8yvE0MgIXecjoPtJTXdCc=; b=BBCyR4OKKtp9muHrR/7KVM8JGaFCzkicrWGtthQyJuAM574UccCkjwBaMyiOCAslMM1kBe3yzgF/O+E9hivmt8aL7WbLfmRcVpnV0iSa83hM8Uqf5ddAUzsGKHKCvdr182IquPDLNwe6V9iX94ALJ7ujlcYX2vtXNqxB8tgu53s= 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 165480870784398.39335778972008; Thu, 9 Jun 2022 14:05:07 -0700 (PDT) Received: from localhost ([::1]:58896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPKw-0000JI-RK for importer@patchew.org; Thu, 09 Jun 2022 17:05:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmS-0004BO-VN for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:25 -0400 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]:45050) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmO-0008SR-FK for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:24 -0400 Received: by mail-pl1-x635.google.com with SMTP id h1so21111454plf.11 for ; Thu, 09 Jun 2022 13:29:20 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:19 -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=DZfUsxzMa6ISMCnyMY5oUW8yvE0MgIXecjoPtJTXdCc=; b=N/PtKLN+DaNyYNedI38JkBBybfI/cMSzKWB3QEhzyg417e4BFkf1xVVLnfI4tRj0WV LrkL/ZrqBzxIBYOAXCsFEjV/aZ5O+6b1rQaKXSlq75EzZZ8zj5977f2DgWfUiCdjNlsf 5or23/Dzy9q6SbhkrP5nEwOn8ccNCVL2B/cQgs+Sl1WmbexpWxbVkfbl3FZSfeJ3XpKJ bg/IZ1knuYh1yvIN/vp+1TZBYcZXF+DlIQVA6+D9E74mnmzn+n9tHZDeD5/LqCn9/0U1 PMOkR92bk/83Ttjt94yGcD79kIOQvcy7p/SMTgMZAwJ8QKvxPYBuFy325LgZAYqYoY5n dDnw== 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=DZfUsxzMa6ISMCnyMY5oUW8yvE0MgIXecjoPtJTXdCc=; b=Q7AYDMasH+xhskqLApp/jdScunfOclzOTAYl8q0X9KsKbxEjcMbGXeEPkTwE6jQ7x/ JnzjbxMAZNwzTelZgTjqf6EzATbXjNUrt8p/M7G+M/nxEOhxPc3Y4rET4/LVi0VaWFs6 U+K1QQObFsgPvZWbMCZAyqpv1zxrrps44AwSZzFqt2MFOpGyM3xWNutrMER+vNdr6Mz9 dBIja3w/defY49AQRSNc/d0x6+3ipdpYwjVx0loQ5jru6UYHrgpzQ3pBNF+arq1LDfDt +12lGYCEPoX1zsZiL1b8ahFlk6Nrftvv8GyUhALf8o0A+65C7M8B/mrnvc5FtQDLtStT BC+g== X-Gm-Message-State: AOAM5330CWEsLQyi4QZVgUcDg9tPB6p8ohPWK5VfjClUoZaA4buS/F7/ ztRBxqq+I+J3PhgTMp9LLn+D5s6R78Fc8w== X-Google-Smtp-Source: ABdhPJxeymeShwUT3saSlmkIV+GkroNZjyraDxNmsjKg3EZCwkhnelmBKWcASvmn8Y2k07fVfEJAdw== X-Received: by 2002:a17:902:f149:b0:167:8569:ec00 with SMTP id d9-20020a170902f14900b001678569ec00mr20336312plb.8.1654806559701; Thu, 09 Jun 2022 13:29:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 19/23] target/arm: Introduce helper_exception_with_syndrome Date: Thu, 9 Jun 2022 13:28:57 -0700 Message-Id: <20220609202901.1177572-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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: 1654808709900100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 db7447d233..07d45faf49 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_2(exception_bkpt_insn, noreturn, env, i32) DEF_HELPER_2(exception_swstep, noreturn, env, i32) diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c index 8a6a3b8551..c5bde1cfcc 100644 --- a/target/arm/op_helper.c +++ b/target/arm/op_helper.c @@ -399,6 +399,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)); +} + uint32_t HELPER(cpsr_read)(CPUARMState *env) { return cpsr_read(env) & ~CPSR_EXEC; 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 Sat May 18 14:01:37 2024 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=1654808935; cv=none; d=zohomail.com; s=zohoarc; b=POE4mSXVdg6NkJH86mq08hcr38sdEzBmRddhjokPLYc8Z4jbnrIOmfNlV0AwN925mViplfuYOVuTqbWGW8CFGT/p0utJlYhXPsm/U+abnCEGa7FOWjv3aNx999OLF1D3fM7EJqB437WnsOlH4qR2ACaoLjI7khrM1Wz5Uojj5e0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808935; 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=NNURr0Aht9d3sVCPfMyWxRyw8UmQdVCrRycp0Xr9WSw=; b=XWmhdjHWpHe8OBT9hKgtdndNKCmTkqODAnx/CzbsSeRf72lk2u8w9cRwxqykMJt21VImvPc0p/3Qklf/12iYUQS8H8vjaD7FShWW9SB7NZb35L/3Izqv2GytERxuMPNwsLCdSOLzq/h3O3LdgnGaJ0nCrxBynGFKvDqvLGzFD5I= 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 1654808935458996.0539359014775; Thu, 9 Jun 2022 14:08:55 -0700 (PDT) Received: from localhost ([::1]:38304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPOg-0005nZ-6V for importer@patchew.org; Thu, 09 Jun 2022 17:08:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmT-0004CF-E8 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:25 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:43543) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmP-00006j-WE for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:25 -0400 Received: by mail-pf1-x42c.google.com with SMTP id x4so13473051pfj.10 for ; Thu, 09 Jun 2022 13:29:21 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:20 -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=NNURr0Aht9d3sVCPfMyWxRyw8UmQdVCrRycp0Xr9WSw=; b=SWzOqtuTgh4aufDOFdAO2VRhFLaSfi+bad40b0nEpx4v1wdexz4ihb7vfF7BAbMEX3 6Ags2WacphEl0Cloz8pZFpuLlfRvczxNJyULz+4/oECzpMxJ3oNJoR0nZAd7uE0jXURa 2LRuJabiylTPnIFjsTirxm69BeUgNfW4dWlYvb9fgDFmEil3gl2j+guzQHCyQ2auqOYf HdlQT7GNobyBq90+bYUlhymMmzTsyI8tDtJTu1wMhXLJu4mmbZqKG/Zxw4jRVWQmsDe4 nUcyKr576RsoLhJtUaNgdxniZhpdlc9wzBlBLvxzaeA1nKmFTcs5vOchHiEf6PYpOCeE JsxA== 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=NNURr0Aht9d3sVCPfMyWxRyw8UmQdVCrRycp0Xr9WSw=; b=vhY5ig5dy/6dJCqh1gxyBDq0NMPve6XCdhhtDvUlvPPu93Z+3mHCUR/yBZkeCGEKOT xiPEXGirMVnjxL/pl7VFGOwAhVF8ATVJ8+xEb3Cc2V5Yqv2ehi+XtwBocGLX6eNXd2f6 jJjVAUMSoIrG6SwzHJ+1FqX6+6dbXJ+jRc5Ptr+LqXT8UTVLSzx2u6Zi1QdAytd6xrmj eD7YlcSR3sIKPM4eSY44l6SY1eYY+LO8BGOyjMS7CK68BU3YFRBZBt2rrddpwe0S1CoO 8eVuYEpKeTgWWdLN5djMbcwAfvShrNX4xmPATSlbE3Kjn5nFgL7dlG44pP4N3vXZx45n 1PVA== X-Gm-Message-State: AOAM532MTIyj8/siJ6KHe1ZYX0IoDLjLJvzRqxQNeB0O3EKTrrnu5Lq9 uiJqmaGsnsRpyIAXGJFAInTATSAkRO5CkQ== X-Google-Smtp-Source: ABdhPJyolm1M9LSSswmGAcKa97OJr7nx1TleUjERO6h+6QJVdbuY6L5T+Hb3saUXDRn4dvqhmCUDsA== X-Received: by 2002:a63:1a0f:0:b0:3fe:4da7:1a38 with SMTP id a15-20020a631a0f000000b003fe4da71a38mr6055172pga.332.1654806560598; Thu, 09 Jun 2022 13:29:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 20/23] target/arm: Remove default_exception_el Date: Thu, 9 Jun 2022 13:28:58 -0700 Message-Id: <20220609202901.1177572-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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: 1654808937179100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 850bcdc155..88dc18a034 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 vl; /* current 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 4f6181a548..4c64546090 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14585,11 +14585,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 Sat May 18 14:01:37 2024 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=1654809334; cv=none; d=zohomail.com; s=zohoarc; b=hXDu+2P644igJ7LXgI1sQNuXmAbtT3ntxJfSsW4i4e9BOWhTHULLPEkuhoVfkcRBpkycJzHR1W1+fpCWiRahbjTLfvRUI7VkISRFkP1a62zY7D5z3m/7KmkSdoS3rb468E+ykea/l8YeA+iiPrPFLQ56RAbYQnSLpfrdfnGV83w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654809334; 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=ZvVhJ9luWKkwdZYjhq+lmyv/sw3Hp1aeF2mDU3UCb9I=; b=JShQq/AXJPkw2TRujrMCpHnn4k+hyk8rfOWcwvvAEkNrAY6oivmEQYvsps0ys2882gHGbxCbyEL+yWuYfwJW99sPk6U4pxdZz6GkpGnHt6Gc4eu2jEGm1G2jkpL4JftFbs9+wgx/Bnfz+mWzscC4l4zgJZiDa9xzOUaYdsTSilk= 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 1654809334530356.96511819513887; Thu, 9 Jun 2022 14:15:34 -0700 (PDT) Received: from localhost ([::1]:45974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPV7-0003Ah-8i for importer@patchew.org; Thu, 09 Jun 2022 17:15:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmX-0004G3-0Z for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:29 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:36519) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmR-0008Qi-Li for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:26 -0400 Received: by mail-pj1-x1030.google.com with SMTP id u12-20020a17090a1d4c00b001df78c7c209so379259pju.1 for ; Thu, 09 Jun 2022 13:29:22 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:21 -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=ZvVhJ9luWKkwdZYjhq+lmyv/sw3Hp1aeF2mDU3UCb9I=; b=DPulRIgojQCZy6t5X9+M99Rqkf7yq/DJOkd1kZalEiFRDXJog77c/qCzgTuJ08CDhh UNGE6JeqZudQ6EfcoWeEBglJCaVjq4f5yrZ9R4WWCNIWc5fcuevs+DiI8w+zzpeCopP3 OWDdxvIAwUqSjFVtFjfdyflfZdAbcXOIX60mx07rf5lQdSujthQfjCddAK3SYnykzLii EFdPnJOAw2FhPYCze5CEwFhWrZBGAqfr+xGU2eGgXl8JocGWVgEeWM/BVH6KlOZdCTNG kG2igrLOgkXxoa29sTMpBbjNqeVCZwWASDFq+VYjg6daRt5fKaMYR3TW/HGO2VpSs6AP L60A== 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=ZvVhJ9luWKkwdZYjhq+lmyv/sw3Hp1aeF2mDU3UCb9I=; b=5QYevd1rpA+q03jgN95vxSCfeRiMa9A9fjlaFd2q3dZ9hyCviWq1/oJZW2xJQ5pb3v AT7ekJsW27DuK3gW/RsbkQ/TOsvs7xX0YU9RKdJG51Qcd+xVyCQAiHUDTudCoOps/aZS wV/7arxcoMkx7CGz4Ds3g22ScztR/DGO3EkEQ5lmvbmVUkvmfVvslg86z8usDrek2NJA TBghcXzyGgZuaUpKqrRQL/A7w4Xy1EA6pXuXnGFjf49PGR8+xxwZHx8L3ptUxlca0m9r uUs0wxGa9ejjwdeRNXHNmNOIwgEDQvkqj6sXvnxY9AKbtGShFhf6LUlqnLGeR0IdTiO3 L06w== X-Gm-Message-State: AOAM533+6J2fENwmT8gvTg5whuY9OHMsFlpVQLsHVszz5KGiXKcHmEcI BmxVKgQC2Vl8CNb47KhWMr7wHQYryzdUvw== X-Google-Smtp-Source: ABdhPJye3YztWSG6SnWKnZKXgTw4NoZz/leGXGiMdA/IJzHaqRUKxVO/v+fxYEsk1UWNJ1/P8DD0+g== X-Received: by 2002:a17:903:32c1:b0:166:3f58:c1b3 with SMTP id i1-20020a17090332c100b001663f58c1b3mr39938291plr.108.1654806561573; Thu, 09 Jun 2022 13:29:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 21/23] target/arm: Create raise_exception_debug Date: Thu, 9 Jun 2022 13:28:59 -0700 Message-Id: <20220609202901.1177572-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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: 1654809335396100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 Sat May 18 14:01:37 2024 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=1654809935; cv=none; d=zohomail.com; s=zohoarc; b=l33fico0IXsRS9khqOkdT8WSi2JtoIfiPlUxxLZDAz56wGm29oSYB+c/4HYB2qf+WTio7BtVpG9AfdJke1dnVsuty1wiKfjU+R4n1TuwgNH0ubUv6ElFair+ZljI/pBoVuYznrM7yoxtqlVcNCuhIWdaTxQLFrxYS7M9B0qv6Mc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654809935; 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=rHr3GvWpnhlYyxP8wVfL31GtOWGiQW1hytUXYczR5lk=; b=J2B2Ca2o4ZRYhUnWtq0OHMUEYvCqgK9sqslALzjWlrZ3OM3+s2tyEf7RKlBFK4qljBEUanp+JQ2abU3zSj5omXCV73foc+FQcXRAkP6pNUqZfRQybGoeTP7I7dRlIav17Hsg3Z/q1yxe3TH6HSgUZGa5h/m8kFhU1nTtSrxdHW4= 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 1654809935002605.795493999632; Thu, 9 Jun 2022 14:25:35 -0700 (PDT) Received: from localhost ([::1]:60558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPen-0006V9-07 for importer@patchew.org; Thu, 09 Jun 2022 17:25:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmU-0004Dr-6s for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:27 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:38852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmR-0008VF-JM for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:25 -0400 Received: by mail-pg1-x535.google.com with SMTP id 123so12497620pgb.5 for ; Thu, 09 Jun 2022 13:29:22 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:22 -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=rHr3GvWpnhlYyxP8wVfL31GtOWGiQW1hytUXYczR5lk=; b=FXddmIt9cI7ADeTK9+lMTP4ZfbBamYEfScDKvaQZzcWtszHXPVjPCF4W2w2HS31jtd EJFEn4szy7KevR/F4+67Nfai5j1MOKC46hEpvjGTpw7wZ/MCnHg5QF0sZ+9inFTBx3Yc Ozuo++dicgV72mPNp7VxHoYb9eOB7TNKqXQaAAQmSbtruabF/i3bWD5LicNEgcr5HGFK hltWKmbg7EFbtf77PWTLcPhxO2iqVXW+MkyA7vMFkHBJaGTxwZtMPGM5ZzDICyS01Nqz 56vznTe8/+Kq/qdNB2vPt2A4hPML4zPeDMtRqEccV8JlDTEH/F33sYv7OjvkVUlQfAB/ hY/Q== 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=rHr3GvWpnhlYyxP8wVfL31GtOWGiQW1hytUXYczR5lk=; b=61xCcfml5WoiUriCfQ6pbtLs5l3/UsiKbMb+QP+NO9pjxYrSzvMIxoUOBdOV5VUFgV 6+mxv8x5RGBHvd76O2QRhCtBBB9ky1dMKQleFjfjM1pDW8Yxmr5gv1M3QI14zMblLOeY RLWfxqYETkT+Air0aCVECiGUwC4tVDvArZ92bGdROP0M7fJG+yPZ5vwIuKv1gQ8PRsoO 8a1MZtzveFVpKVlZA7tgN6HR9fdxF5rmayZ7OvDd9+jfoGx8XmAJwLHD5SHo4n1mHYlI oGhqnLxbtNMTZwYQ42k1VCJW0FXzIJSZvQu49pNPlZ/OYikI243mFeDmj9n4d8aCYMx8 b3cQ== X-Gm-Message-State: AOAM5308HpvHpZ2scSKnR0dKvnAMunx0bmjVvFt6uPVftKhzeaS5HXSl 31PwpjO13dD+gwuQbkQMfJq2jkUBYMPSEQ== X-Google-Smtp-Source: ABdhPJzKfZB8t9ylSf/87Inv8e3V8ieEoKvU/dXFIlV7FPifQ8PC1ATJpD2x4Zdv5kmkjTV0Jhc2Zw== X-Received: by 2002:a05:6a00:1956:b0:51c:3a0:49d2 with SMTP id s22-20020a056a00195600b0051c03a049d2mr27029295pfk.29.1654806562544; Thu, 09 Jun 2022 13:29:22 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 22/23] target/arm: Move arm_debug_target_el to debug_helper.c Date: Thu, 9 Jun 2022 13:29:00 -0700 Message-Id: <20220609202901.1177572-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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: 1654809937209100001 Content-Type: text/plain; charset="utf-8" This function is no longer used outside debug_helper.c. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 719613ad9e..161ac9fa2e 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2986,27 +2986,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 Sat May 18 14:01:37 2024 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=1654808739; cv=none; d=zohomail.com; s=zohoarc; b=nOCjx6pogehEKWJv/qBKo3ACr3EDtejDlpc3DThGmpi6YIh8v1Dco8Faf+A/MRx37bIhDj7JtenFRNYyZY5uYZx0v4KGxmM2wK2U3Ew5RE6190GEy3q8RRfmFWN7oAz9Y6ZbswsJU4DFQtpveeVjR4NOYRgszYR1DxjtVtxlNLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1654808739; 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=odSylXA2XRBD0oTe2Ed3JfqFz439C4lE/Ju+M7CRV9E=; b=LbsjsjzVOHXdbYXDlnZvzmNHE52b6w9MeuUj4nm040pYPW4rxI7Csk3aI7Wm9uctrtc6KVNnKkhJMUZRJ44aaLnfnMSqAI2sNl04hDdoFwvlC2e63ls6O2TWe6oqgxEvxhS3Ehfgvv2+cD+q2j83YYEdaieZ9INxAswHC8BpLkw= 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 1654808739097374.9546319026381; Thu, 9 Jun 2022 14:05:39 -0700 (PDT) Received: from localhost ([::1]:59170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nzPLV-0000Ua-2B for importer@patchew.org; Thu, 09 Jun 2022 17:05:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzOmX-0004Hk-19 for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:29 -0400 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:47061) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nzOmS-00007y-Tu for qemu-devel@nongnu.org; Thu, 09 Jun 2022 16:29:26 -0400 Received: by mail-pf1-x42a.google.com with SMTP id j6so22008061pfe.13 for ; Thu, 09 Jun 2022 13:29:24 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:839f:476f:678:38a]) by smtp.gmail.com with ESMTPSA id r20-20020a635d14000000b003fded88238esm7528139pgb.36.2022.06.09.13.29.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 13:29:23 -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=odSylXA2XRBD0oTe2Ed3JfqFz439C4lE/Ju+M7CRV9E=; b=s3WJ8EPB6vmK1cLVlBRzxg1KDbZ1KIK9Wav1PynJGapIlLproIJwNOK39qR3M2PNZX 0Zou14sdBtRNK2el+iZ8VU4EQ0fSA0m5/iHBVl9W2fTJyd2ojpfnNIenhjHLoGAA+4V5 WqGbkvvO8PnZoihF+f0Ip50XT+L1gaT/mQMoqeonQ8SVUCjJkOD1scKS39PPhv/IZazc pMygNIkGTSc/3dh4J8S3kuEsxwWh/A8M+7rLrqA3xJBrB1emzfi4kL9jk3KngEXKciqH pgfv8PkfNzR31C5JV73l806rGyrv+pAoMP6/kWz2ORhP3kqclEnBCixXcCJ0sgaJV9TJ qWFg== 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=odSylXA2XRBD0oTe2Ed3JfqFz439C4lE/Ju+M7CRV9E=; b=CUfyo/U4Aj7+urUiUkgTEzMb+vXm2xPsVIychYSt++LTlVvgATp0DTkvJpwnK/zx9D 5K1AP20ayH971H4JBGK7JLTfilRvJk2qaEbPVsyuE+yBrSKNRQyRCvkeFL+3olt3E87Z 48SI0Nj17u8jBu2LsWpo5H2OhBmLAxZRDWhfCr1slGkmsuLFjNFrz1uCAB4GznY4F9vJ vklTcWBW9sXgSGKIeh2ubLru615oZJ6S50XGKnxDuIh5+BDicWAx8Cx/SieusIkoyHVb uOCTqkL18zjBaR9F5QzaphnUXkULWEnOUi7mCn3b+MAO7rzqwzh/sAdeRpyOhcjmDDcg TGFA== X-Gm-Message-State: AOAM530/8sjOeOzKdqmtWT+Tkf5093YMRdxTIP7pFdzksZSYNwtaJAYR 3FgfIahLgaN+gbij8XVlSY5GFlrhXmRDQw== X-Google-Smtp-Source: ABdhPJzNIAJucNwoF7LXhj7KDw8FhJbULBy0V+/XRLRQz0l8B209N/SwiPywj1fZIXcvWXAPyvOdKA== X-Received: by 2002:a65:644b:0:b0:3fd:d5d5:8c7e with SMTP id s11-20020a65644b000000b003fdd5d58c7emr18319992pgv.590.1654806563562; Thu, 09 Jun 2022 13:29:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 23/23] target/arm: Fix Secure PL1 tests in fp_exception_el Date: Thu, 9 Jun 2022 13:29:01 -0700 Message-Id: <20220609202901.1177572-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220609202901.1177572-1-richard.henderson@linaro.org> References: <20220609202901.1177572-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=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: 1654808741935100001 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. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 2b2c1998fd..b95aa53474 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -10879,27 +10879,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