From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C984C606E845 for ; Wed, 21 Oct 2026 03:24:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=UL6IpIKD; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=QO6RNLXw Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xJMqU-0008Dg-JI; Tue, 20 Oct 2026 23:18:30 -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 1xJMpf-0005Vq-1M for qemu-arm@nongnu.org; Tue, 20 Oct 2026 23:17:39 -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 1xJMpd-00033x-55 for qemu-arm@nongnu.org; Tue, 20 Oct 2026 23:17:38 -0400 Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 69L2FBU83116143 for ; Wed, 21 Oct 2026 03:17:25 GMT 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= +EK3zscJwoQQDbnM5hHAO2MOpUzNFtj5kae7Svd/g0k=; b=UL6IpIKDVMK/gvjs 5Zn1/Rps2XWNe8tZ7wTd7wYlVYop6wZGa5afRzFe8zqm9JqnZHdUQlOJQFnF3rd7 u6yaFa0kOwYlVc9zi6+vPOSFAHtuIsGVZDnCEohHuAMUAtU8AgWikTy5zIVLzfbT L4A9zyrDzDZhBoC69URi76pENbTYDJjtJNB3nZUo/NqnY8WwLAqV9dSrdQiEDWvg 5D+PEV1K8vgY4AFMohXOmFVmOLR0PfykRlhtj+PLuZs8lpNXXFW3frkDqFkScQZS ovJBT2e45aPTbJOvUXPcm3BQK59PeEbLSU8SZUp5sU1nIthTVsS8u+JPEW/aleat zT9r9g== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4hed9hsr5s-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 21 Oct 2026 03:17:25 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-93cb98809caso59220785a.1 for ; Tue, 20 Oct 2026 20:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1792552644; x=1793157444; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=+EK3zscJwoQQDbnM5hHAO2MOpUzNFtj5kae7Svd/g0k=; b=QO6RNLXwCrALX/JJS7vVPfNeuuH0duS2lq84pL9wp1wcI62+j7RZJm2H6u9lKqNIaH MVEwCzfZHFysi+AMiQUlcP+TooqaxMp+BvLDfFbzMyDVJ5gHOpRMfJwKbSx7r7p7Y7q0 w0ZN8AcbU+WUCZkbt5diV687R5wNg8pfEdV+z5gLiTn3YemdLoH21zzq41LQxeNClokU KnBuNlm/7iXvPOzWANlYslIsaajB+SGbRDMRAz+DwN9+QOMAwieJeMI9gscO1U4q95c5 agblS8RMX4nQQEM7cLlhIfUkoNq/O7k6/KzcjYM7CFz7eB/qL1N2JbWq6hpmwS7Zq2X2 AHxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792552644; x=1793157444; h=content-transfer-encoding:content-type: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 :content-type; bh=+EK3zscJwoQQDbnM5hHAO2MOpUzNFtj5kae7Svd/g0k=; b=mGtXqKoIwWgpgLa/W0iRzHv84cPnVxQh1hByxQPI/ngYA6xEeU8PTST9Inrl0jEao6 5xwP8auESJxtaV3PAmYTRarhcudMOPpyEJANhgNC3MTffPgSBxdocWd1FV8/ryOb5n6+ XIEVASIDBh+O/SQF6KircmgoRAEniIuQQ7M0UPwXvswHVkWJ82RrkVBfkjLjMEEgvKcD YLAfsSss2nyRumm9XtG6DpOMHedOMyDBFAmQ01kIcpm6tDx52JTXKgoFocB8Z9qXHOWo gO8AFT9vG0WYSV3w1iSBS12DuiZpegxhLwMq7YmHvEpO1hoP+I2OyFASjc1CqDWDdDtW VyFQ== X-Forwarded-Encrypted: i=1; AKwUvBxjM0I7dZcMgi9db6DOFP4/71zqa/fPslOD3iExzblwrVEWc0W8HoSTDs0Qvh18/R6PveMofBVqOg==@nongnu.org X-Gm-Message-State: AFq9FYLipInJMxuEbofPt05Wz9uNXKnYjusWozIlpRt94Vw7SCj9UPXO wQfgPmRnwSIejGvC1VGjkLXpgNWVTLUrxeI+P5hackS0gy6h+5P4Z6FjykchoajWlB7DX79pHq2 zpF5lbhb6YdmiI6k8i5rFg1Pz6xCs4vikyfrixe0pYAwDWxHpedzfCK0= X-Gm-Gg: AYBFou1v5pNynXHQyhiRqbOWpKnHkJPmaXFCS5Ubdrmln3e+A31uUdSS26Lp4w4GGCa J0G47hRXy2OqvRCydLvuh89nI7HA4HiQMMrLiR6M4Jt8sXY3MQbj7u0ck+rOVya7X77W1pSMEnI rK2I/yUqHVD2a4HlkehGf2k4euif7qQyyP00gzziJapV9gMhh63MfskBCKDHmU8d4V3ntbzU4PZ fVHpGvQs5e6IUgU3HQJH0cmNYrtlMIRray9X65IGtw+uiId7cIH2j9Lzx+/PAX0iL6yOU6yNKgm hiB/OMdZPEQbDcpipriAzmQSEjaWaNZYaS1SYbJ6vh4wZ8ti4srL5sirk1n9/QSeVIOnlRBXPNM 075QzRw2QLyszReBCCcRoV5QwnOplyLdDAj2ZY0YR X-Received: by 2002:a05:620a:261d:b0:93e:fd69:9a93 with SMTP id af79cd13be357-93f57f84f2fmr203776385a.31.1792552644486; Tue, 20 Oct 2026 20:17:24 -0700 (PDT) X-Received: by 2002:a05:620a:261d:b0:93e:fd69:9a93 with SMTP id af79cd13be357-93f57f84f2fmr203773785a.31.1792552644023; Tue, 20 Oct 2026 20:17:24 -0700 (PDT) Received: from localhost.localdomain (pmd666.hd.free.fr. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a1fcd70027sm11156995e9.0.2026.10.20.20.17.22 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 20 Oct 2026 20:17:23 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, qemu-arm@nongnu.org, qemu-s390x@nongnu.org, Pierrick Bouvier Subject: [PATCH v2 25/33] target/rx: Register CPUClass::exception_name() handler Date: Wed, 21 Oct 2026 05:13:58 +0200 Message-ID: <20261021031407.24862-26-philmd@oss.qualcomm.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261021031407.24862-1-philmd@oss.qualcomm.com> References: <20261021031407.24862-1-philmd@oss.qualcomm.com> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=YuKa1IYX c=1 sm=1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cEJkwyXxCpUvDJ X-Proofpoint-ORIG-GUID: wEIHUOExfMlKCwfoFEcEJkwyXxCpUvDJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-10-21_01,2026-10-19_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 clxscore=1015 phishscore=0 adultscore=0 bulkscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610190000 definitions=main-2610210012 Received-SPF: pass client-ip=205.220.180.131; envelope-from=philmd@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 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, SUSPICIOUS_RECIPS=2.51 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Factor rx_exception_name() out of rx_cpu_do_interrupt() and register it as the CPUClass::exception_name() handler, so the common exception logging can resolve RX exception codes to names. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- target/rx/cpu.h | 1 + target/rx/cpu.c | 1 + target/rx/helper.c | 53 ++++++++++++++++++++++++++++------------------ 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/target/rx/cpu.h b/target/rx/cpu.h index 0d9f4898a26..06208380621 100644 --- a/target/rx/cpu.h +++ b/target/rx/cpu.h @@ -147,6 +147,7 @@ struct RXCPUClass { #define CPU_RESOLVING_TYPE TYPE_RX_CPU const char *rx_crname(uint8_t cr); +const char *rx_exception_name(int excp); void rx_cpu_do_interrupt(CPUState *cpu); bool rx_cpu_exec_interrupt(CPUState *cpu, int int_req); hwaddr rx_cpu_get_phys_addr_debug(CPUState *cpu, vaddr addr); diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 9b8473d71cf..bcaf6659ac5 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -245,6 +245,7 @@ static void rx_cpu_class_init(ObjectClass *klass, const void *data) &rcc->parent_phases); cc->class_by_name = rx_cpu_class_by_name; + cc->exception_name = rx_exception_name; cc->dump_state = rx_cpu_dump_state; cc->set_pc = rx_cpu_set_pc; cc->get_pc = rx_cpu_get_pc; diff --git a/target/rx/helper.c b/target/rx/helper.c index bc76dd28ab3..ed9cadc0bd4 100644 --- a/target/rx/helper.c +++ b/target/rx/helper.c @@ -24,6 +24,37 @@ #include "hw/core/irq.h" #include "qemu/plugin.h" +const char *rx_exception_name(int excp) +{ + const char *name; + + switch (excp) { + case RX_EXCP_PRIVILEGE_VIOLATION: + name = "privilege violation"; + break; + case RX_EXCP_ACCESS: + name = "access exception"; + break; + case RX_EXCP_ILLEGAL_INSTRUCTION: + name = "illegal instruction"; + break; + case RX_EXCP_FPU: + name = "fpu exception"; + break; + case RX_EXCP_NMI: + name = "non-maskable interrupt"; + break; + case RX_EXCP_TRAP_BASE ... RX_EXCP_TRAP_BASE + RX_EXCP_TRAP_COUNT - 1: + name = "unconditional trap"; + break; + default: + name = "unknown"; + break; + } + + return name; +} + void rx_cpu_unpack_psw(CPURXState *env, uint32_t psw, int rte) { if (env->psw_pm == 0) { @@ -79,7 +110,6 @@ void rx_cpu_do_interrupt(CPUState *cs) qemu_log_mask(CPU_LOG_INT, "interrupt 0x%02x raised\n", env->ack_irq); } else { uint32_t vec = cs->exception_index; - const char *expname = "unknown exception"; env->isp -= 4; cpu_stl_le_data(env, env->isp, save_psw); @@ -100,27 +130,8 @@ void rx_cpu_do_interrupt(CPUState *cs) qemu_plugin_vcpu_exception_cb(cs, last_pc); } - switch (vec) { - case RX_EXCP_PRIVILEGE_VIOLATION: - expname = "privilege violation"; - break; - case RX_EXCP_ACCESS: - expname = "access exception"; - break; - case RX_EXCP_ILLEGAL_INSTRUCTION: - expname = "illegal instruction"; - break; - case RX_EXCP_FPU: - expname = "fpu exception"; - break; - case RX_EXCP_NMI: - expname = "non-maskable interrupt"; - break; - case RX_EXCP_TRAP_BASE ... RX_EXCP_TRAP_BASE + RX_EXCP_TRAP_COUNT - 1: - expname = "unconditional trap"; - } qemu_log_mask(CPU_LOG_INT, "exception 0x%02x [%s] raised\n", - (vec & 0xff), expname); + (vec & 0xff), rx_exception_name(vec)); } env->regs[0] = env->isp; } -- 2.55.0