From nobody Sun Jul 26 13:29:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1781156095; cv=none; d=zohomail.com; s=zohoarc; b=C/raQ1LoBKF2JCV7BZSwQQML27YnUlzmmLRUiKcZq5K1QKW7/bVCrbLlRM3qePBD97rLqxD92FK/74jbqLhOl+hElLDIEBrnsf8tPVWrmCygxqCcL3F1ygW7XVZ0X/9F4yemQMcpGHzlYpBmzBA+rAo2gTcd29was2RzNO4BCmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781156095; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Bj9eFNWT2Jx7cinFrO9cHCVAd0yrhcaMGOXbDIJ+gvc=; b=GmfYE+GG6LYogvRUEf5BS1Bx0mRIM9kIlrD0hvRqmzJb8n3j74Jy8s0GAQPm83Vp0m6uKcXE5qnihpc5k3IWTKf/gWh5+Hm9RHeyBy6HwKsq8+moIstsK9MlAl0SzMrL8Rk3rKLcufvA8ykyj9xfX38YjikTs6MTs6jWFSEhnuk= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1781156095352659.2383487937137; Wed, 10 Jun 2026 22:34:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wXY3R-0002WS-QN; Thu, 11 Jun 2026 01:34:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wXY2r-0001gX-WF for qemu-devel@nongnu.org; Thu, 11 Jun 2026 01:33:40 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wXY2q-0002n8-43 for qemu-devel@nongnu.org; Thu, 11 Jun 2026 01:33:37 -0400 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65B5GCZW3843612 for ; Thu, 11 Jun 2026 05:33:35 GMT Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eqe701rty-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 11 Jun 2026 05:33:34 +0000 (GMT) Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-308004a2c49so1582717eec.0 for ; Wed, 10 Jun 2026 22:33:34 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30806ee207asm720800eec.29.2026.06.10.22.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 22:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Bj9eFNWT2Jx7cinFrO9cHCVAd0yrhcaMGOXbDIJ+gvc=; b=SuqN1Lyj5w39FUUb wAKA9rfYVlm857m0OorPOvX+ZJvrBfmIKUjh000q85q6bz9cdvkOVP4r1WH3oL0p inwDmdfrpzbm9N84xK+E+MxXqM1USPJTEzxcgsJXxfyCHjf9tzySZpdVh93m3Rxu 8NR8pGvCaqQ/gwx3D5JBuE1YdYIz/yLczizqs+qc4voC3bPG+kdJC1CF45r1yoZV ty67fP+SC1hxMwDTrK2LLEIQl9VlpLw0AZzj4RabfnhcF7c3NporEQVNrvw7aHgK OSLOAuk/ifkUS8Tu6NMJ/i2jxio0xSZ1LVCAGhwnAG3AgMTDEmIjx0r6jPKysziF 11t8hA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781156013; x=1781760813; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Bj9eFNWT2Jx7cinFrO9cHCVAd0yrhcaMGOXbDIJ+gvc=; b=eTOegFA2NUMPQbY1qaVGTPwAWVdkHiCcAR0qamQfZjqGV0gH7xrXBjfvweqe8l5d5Q W5otNm5ZT8u6olLKDEceMRlAgBbqbwfUje56C7BTqqlNKqdGWo08QRNFJLONmVjsfYWm avmNczrgB0ZoHYDzsDiYHWazkv68rlib7ImLyfIIm9CMA9zkdZrOJBSaKVMQSF9/6xpe X3hYEa66yGc+FLrY1pJ4bTEVgr+W9uoaiVcaOtKj6Dh/FFIgUcCX4a+xelxt4/dykEIC j+xFW7ZCCB8Z7EqvcJM1eNSsXGNbIawjpuQOvu/QzIVs9JsuVmXfjK0GjKT963ZnnhXD vcsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781156014; x=1781760814; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Bj9eFNWT2Jx7cinFrO9cHCVAd0yrhcaMGOXbDIJ+gvc=; b=LDND+69CorqAg47ZbAaWEJel+C8pdS60g2lpl1RKPV9j9/2akU5DOZXxPRKxKMivmR +4HeTDONPK23duoLQxBV3jRQrK5CYI16XihVDEEbWYRE17SYw25M5mddKmnzgi143lYC +0eDDrNZDlMNdwkqwE4jZ8u2YTwt95bv+8VHYqZ9+x9OvD+rC1FJ1/Dfolz9utuakob+ OjBUQGHCt9uCxAOTUa5v2QBNjDpTQEwe7j+7DVyZLoBHCmOJVrzkDPsR1pWB0/SFOC8h vqmRDZ2wxpstRzwdlts+IwwXOSATpad2OT9hKeCYiW9IW/EnxLl//JJ6FQF8xqyW0any aEUw== X-Gm-Message-State: AOJu0YzWyplEw+O3ZwTYXCyr2Ll1uzf7O6ufxKjbtCqdUwMU7ZOdzWIx BSMhfYumYtyhHXuiBb1gOBrGfajZd3LsZQphk4lKcS1rwpmBlVemQo2JFmqtUZJLk0lu9p1qgnr bVmddW5i8CSh7Re6Ia9P10DCPxLd2HWH5hJPmvGC9YItm5lhPLCVQYbr2558uhDHDjw== X-Gm-Gg: Acq92OH6eZtfWogeDymSM6f8z9ShYVpnFkgk3sO3c+oS1crUy1wtRbyBwHihXPvFDP4 F5/zq3yDnhXR8T9moDPVSC4xDUuVqLz/e/CYnUvfD10P3xAC+7vugr3OyhwQhcIaHuWPDdLNAoW +TyLWah6UTugXmuRErx+bjya/Xdp21zdJEOdAeZCCS+oiqBITBJ2bB5JdUfUNEIQgsZMNPj0W0Q SHW030yQ6PxrKCSItqyAxchUOPoInGPgzugqs77hj34IE7OUBN/f432U6CES38RU2kxn/urNSeI B0vjZct9xFNh9ySa/Y2qYZ1GlwzvLvJATGfg9FOv0tjD1Y0SgctllcfpYgFPrXlnqBatIaYWay4 YmX0ArjxHYrg79MAEIctHy1EI+HUJYSILAbbhIWnjn1Yfx26XFGSGuem/ZoXC3FwIcSH7K6JGeu K7O81c X-Received: by 2002:a05:7300:b918:b0:2ea:ed3e:13b7 with SMTP id 5a478bee46e88-308046071f2mr1160023eec.7.1781156013462; Wed, 10 Jun 2026 22:33:33 -0700 (PDT) X-Received: by 2002:a05:7300:b918:b0:2ea:ed3e:13b7 with SMTP id 5a478bee46e88-308046071f2mr1159997eec.7.1781156012863; Wed, 10 Jun 2026 22:33:32 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: brian.cain@oss.qualcomm.com, matheus.bernardino@oss.qualcomm.com, pierrick.bouvier@oss.qualcomm.com, ltaylorsimpson@gmail.com, philmd@mailo.org, philmd@oss.qualcomm.com, Brian Cain Subject: [PATCH v6] target/hexagon: Add PC to raise_exception, use fTRAP() helper Date: Wed, 10 Jun 2026 22:32:46 -0700 Message-Id: <20260611053249.3918491-26-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260611053249.3918491-1-brian.cain@oss.qualcomm.com> References: <20260611053249.3918491-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: MNbGIm-YZqd0wRgAhRvTcqMBAuyeNq-z X-Authority-Analysis: v=2.4 cv=B9eJFutM c=1 sm=1 tr=0 ts=6a2a48ae cx=c_pps a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=COk6AnOGAAAA:8 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=4FQt9sIIQT5CW9ciUtIA:9 a=QEXdDO2ut3YA:10 a=bBxd6f-gb0O0v-kibOvt:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjExMDA1MiBTYWx0ZWRfX+E7kzjE9YF56 RX7eefxpjtvioAUyQwVD1X7Vk7CbgE+1zqXaYHs8d/PyzHDex1ix3OcaXkGbA3S+HGJIk/7iZPc FvSl8B82U1T1tJg8SsQ0f4DPzh/RSKqEdQKa60y4IOpnR3D08s30LFDC8FSr1gpSf4IHgUA52DR 0ZBmW0eIPSSNJ9PI0MNT2mXHAm1KNga65CHNJFpVL6EB2iT5Zc8E++yjnoaz67BqIpPnOA2p/h0 LmeZJP9g+Iyb93ZfsNjL2ZyQyFpQLIA30UqsCY840LG0gxq1MruHyrITpPUzl+8EY001XjFNGrq PTemtbS82BtI6WXW/HI2OatspgqtYevk5j0UYWfuoDGiXPSN7N+lzx8xtInA9OHqzmd+PrFMoHr y5iJm2XzjivKpZVXCiGGyllAyTyZoJDthdnIZYyY9KZM4Yu2/f1PSoeUX2hgb7RuHFelilQo57I DOlH20RaNMA6jP/NGKg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNjExMDA1MiBTYWx0ZWRfX5JRtL7ko0vUY dpRngkFX0LxqqzZbPV6Ux1acmJD9jYSju1AD+9gjTka8NXOtxG1vTtILla7rSp8ExOHlGWArauS o4xIkhFAIq49vDfVqUHveuzsxop1Av4= X-Proofpoint-ORIG-GUID: MNbGIm-YZqd0wRgAhRvTcqMBAuyeNq-z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-11_01,2026-06-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 malwarescore=0 spamscore=0 bulkscore=0 phishscore=0 suspectscore=0 clxscore=1015 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606110052 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=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1781156096025158500 From: Brian Cain Add PC to raise_exception helper Replace the fGEN_TCG_J2_trap0 macro override with the fTRAP()-generated system helper instead. Reviewed-by: Taylor Simpson Signed-off-by: Brian Cain --- target/hexagon/gen_tcg.h | 7 ------- target/hexagon/helper.h | 2 +- target/hexagon/op_helper.c | 10 ++++------ target/hexagon/translate.c | 21 ++++++++++++++++----- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h index 4a58ead877b..a28af0c245b 100644 --- a/target/hexagon/gen_tcg.h +++ b/target/hexagon/gen_tcg.h @@ -1349,13 +1349,6 @@ #define fGEN_TCG_S2_storew_rl_st_vi(SHORTCODE) SHORTCODE #define fGEN_TCG_S4_stored_rl_st_vi(SHORTCODE) SHORTCODE =20 -#define fGEN_TCG_J2_trap0(SHORTCODE) \ - do { \ - uiV =3D uiV; \ - tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->pkt.pc); \ - TCGv excp =3D tcg_constant_tl(HEX_EVENT_TRAP0); \ - gen_helper_raise_exception(tcg_env, excp); \ - } while (0) #endif =20 #define fGEN_TCG_A2_nop(SHORTCODE) do { } while (0) diff --git a/target/hexagon/helper.h b/target/hexagon/helper.h index aa3604dbdc5..033e5619d6b 100644 --- a/target/hexagon/helper.h +++ b/target/hexagon/helper.h @@ -18,7 +18,7 @@ #include "internal.h" #include "helper_protos_generated.h.inc" =20 -DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32) +DEF_HELPER_FLAGS_3(raise_exception, TCG_CALL_NO_RETURN, noreturn, env, i32= , i32) DEF_HELPER_2(commit_store, void, env, int) DEF_HELPER_3(gather_store, void, env, i32, int) DEF_HELPER_1(commit_hvx_stores, void, env) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 1ae58b78726..43220a121f6 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -65,15 +65,13 @@ G_NORETURN void hexagon_raise_exception_err(CPUHexagonS= tate *env, uint32_t exception, uintptr_t pc) { - CPUState *cs =3D env_cpu(env); - qemu_log_mask(CPU_LOG_INT, "%s: %d\n", __func__, exception); - cs->exception_index =3D exception; - cpu_loop_exit_restore(cs, pc); + do_raise_exception(env, exception, pc, 0); } =20 -G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t exc= p) +G_NORETURN void HELPER(raise_exception)(CPUHexagonState *env, uint32_t exc= p, + uint32_t PC) { - hexagon_raise_exception_err(env, excp, 0); + hexagon_raise_exception_err(env, excp, PC); } =20 void log_store32(CPUHexagonState *env, target_ulong addr, diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c index f5450ced7de..e0418ee990d 100644 --- a/target/hexagon/translate.c +++ b/target/hexagon/translate.c @@ -126,12 +126,19 @@ intptr_t ctx_tmp_vreg_off(DisasContext *ctx, int regn= um, return offset; } =20 -static void gen_exception_raw(int excp) +static void gen_exception(int excp, uint32_t PC) { - gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp)); + gen_helper_raise_exception(tcg_env, tcg_constant_i32(excp), + tcg_constant_i32(PC)); } =20 #ifndef CONFIG_USER_ONLY +static inline void gen_precise_exception(int excp, uint32_t PC) +{ + tcg_gen_movi_i32(hex_cause_code, excp); + gen_exception(HEX_EVENT_PRECISE, PC); +} + static void gen_pcycle_counters(DisasContext *ctx) { if (ctx->pcycle_enabled) { @@ -140,6 +147,7 @@ static void gen_pcycle_counters(DisasContext *ctx) } #endif =20 + static void gen_exec_counters(DisasContext *ctx) { tcg_gen_addi_tl(hex_gpr[HEX_REG_QEMU_PKT_CNT], @@ -211,8 +219,11 @@ static void gen_end_tb(DisasContext *ctx) void hex_gen_exception_end_tb(DisasContext *ctx, int excp) { gen_exec_counters(ctx); - tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->next_PC); - gen_exception_raw(excp); +#ifdef CONFIG_USER_ONLY + gen_exception(excp, ctx->pkt.pc); +#else + gen_precise_exception(excp, ctx->pkt.pc); +#endif ctx->base.is_jmp =3D DISAS_NORETURN; } =20 @@ -226,7 +237,7 @@ static void gen_exception_decode_fail(DisasContext *ctx= , int nwords, int excp) =20 gen_exec_counters(ctx); tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], fail_pc); - gen_exception_raw(excp); + gen_exception(excp, fail_pc); ctx->base.is_jmp =3D DISAS_NORETURN; ctx->base.pc_next =3D fail_pc; } --=20 2.34.1