From nobody Sat Nov 15 22:35:17 2025 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 ARC-Seal: i=1; a=rsa-sha256; t=1747668222; cv=none; d=zohomail.com; s=zohoarc; b=cnXPKBd5Di8yh5ontHIAu/HIAAEnptfH49oiq817ClTRi77NWd5e1vYOpFj+P3Qw4xylArmfRiJwnPkLbiPhcEJmDiTWhh5DL9z9XTl0IdmK8PSLylMkdUxrQ2gbwo+VEOKFcYI+KVYZkNMBj+2hfifd8Nr4ayhlz6ztL7zj1hQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747668222; h=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=2Aqjzw7zYTd3NTad9VHCrUBRt2G43DzswN/PL4/HPYw=; b=ZEoHytVJVOG/Gl2CPEdMGgKylY5bscQ1JeXRA9iMmOF6JkXweGWRyok92igBsqq6mfArxn2jZma+nWBs53DlZIn1cXzueq71+zrAADHAFz+VpZS236iFwB4Q9aguwqRaHfeZIFP0Zmq/hQftVxiKVu2tYRckcait+Yrersx6tDI= 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747668222382302.7929558969952; Mon, 19 May 2025 08:23:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uH2IM-0006ya-Gw; Mon, 19 May 2025 11:20:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uH2IC-0006tt-Lm for qemu-devel@nongnu.org; Mon, 19 May 2025 11:20:40 -0400 Received: from mailgate02.uberspace.is ([2a00:d0c0:200:0:1c7b:a6ff:fee0:8ea4]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uH2I9-0005Tq-85 for qemu-devel@nongnu.org; Mon, 19 May 2025 11:20:40 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate02.uberspace.is (Postfix) with ESMTPS id 7324C180E98 for ; Mon, 19 May 2025 17:20:25 +0200 (CEST) Received: (qmail 1494 invoked by uid 990); 19 May 2025 15:20:25 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Mon, 19 May 2025 17:20:25 +0200 Authentication-Results: skiff.uberspace.de; auth=pass (plain) From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , Laurent Vivier Subject: [PATCH v5 11/25] target/m68k: call plugin trap callbacks Date: Mon, 19 May 2025 17:19:51 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.997165) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.597165 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=vccpnbPofMUn5GEYXIKmJ3iPq2zw2c87xl+AJcXAZSs=; b=S2IrBwbD5yd2OYlXrigLyp1gqUQMhXnopn3WiwDCoZhjG9guiLEJNluZb/ALjWXNpGt0qr/QF4 M8TSbsZd4QMmutGWOgL15KM643oUluVVo2TuIMqE81dAfxWD5KsANn0XQ9IkzYmvMYZNniGk0W9Q cQCdUUVGmy752vvdhg32tAnpEZrDytjjqenWjZiByEOatXT6iy7MbkzR2onfIM1hwLFckUCebGcE KEhuQCD6qh79HuGx7iKhGFSkPdjJ0SQdjEqt9F9tBDeLIcVBFz4QdQ2bcMIFmSO2XpBQCgcy7JSe +NME/S0+4N4seYKSkikV+JFY72G8AVDGUzF026WRalDt4Da74zqcv4IBkzVSsqB+abqnwPNbZYLs u+NFjVahRDtsASlL0iS4MQ4RcFp7cMfsqaJ62GP4QVqOtjSoGkbjAYXDX3UtR/i3OOWXbBrbgLfa eZq+EvsNc+UrdSZxKjHPeViKccnNFRZhIhqAREDJSpzeBG0ZO3xIGyey/YiLw1hRl8TCZ6Jz7Pdk FiNLPk3r24uhpjTEPYZBZ1Q45Bhaxw76un6uYAjpeD8U6gu9NvPvAgHLzvH0QbpPPAAJwff5Imrz jO8+doKHBBP4l3cnyJg+J+Xxw/bVVcFOClvMiOdgQ/HQabiK7kjqUnaQJyOQTwyO0UX66fhVAxgS s= 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=2a00:d0c0:200:0:1c7b:a6ff:fee0:8ea4; envelope-from=neither@nut.email; helo=mailgate02.uberspace.is 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, 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: 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 @nut.email) X-ZM-MESSAGEID: 1747668223101116600 Content-Type: text/plain; charset="utf-8" We recently introduced API for registering callbacks for trap related events as well as the corresponding hook functions. Due to differences between architectures, the latter need to be called from target specific code. This change places hooks for Motorola 68000 targets. Signed-off-by: Julian Ganz --- target/m68k/op_helper.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c index f29ae12af8..ca15af5765 100644 --- a/target/m68k/op_helper.c +++ b/target/m68k/op_helper.c @@ -22,6 +22,7 @@ #include "exec/helper-proto.h" #include "accel/tcg/cpu-ldst.h" #include "semihosting/semihost.h" +#include "qemu/plugin.h" =20 #if !defined(CONFIG_USER_ONLY) =20 @@ -183,6 +184,21 @@ static const char *m68k_exception_name(int index) return "Unassigned"; } =20 +static void do_plugin_vcpu_interrupt_cb(CPUState *cs, uint64_t from) +{ + switch (cs->exception_index) { + case EXCP_SPURIOUS ... EXCP_INT_LEVEL_7: + qemu_plugin_vcpu_interrupt_cb(cs, from); + break; + case EXCP_SEMIHOSTING: + qemu_plugin_vcpu_hostcall_cb(cs, from); + break; + default: + qemu_plugin_vcpu_exception_cb(cs, from); + break; + } +} + static void cf_interrupt_all(CPUM68KState *env, int is_hw) { CPUState *cs =3D env_cpu(env); @@ -200,9 +216,11 @@ static void cf_interrupt_all(CPUM68KState *env, int is= _hw) case EXCP_RTE: /* Return from an exception. */ cf_rte(env); + qemu_plugin_vcpu_exception_cb(cs, retaddr); return; case EXCP_SEMIHOSTING: do_m68k_semihosting(env, env->dregs[0]); + qemu_plugin_vcpu_hostcall_cb(cs, retaddr); return; } } @@ -239,6 +257,8 @@ static void cf_interrupt_all(CPUM68KState *env, int is_= hw) env->aregs[7] =3D sp; /* Jump to vector. */ env->pc =3D cpu_ldl_mmuidx_ra(env, env->vbr + vector, MMU_KERNEL_IDX, = 0); + + do_plugin_vcpu_interrupt_cb(cs, retaddr); } =20 static inline void do_stack_frame(CPUM68KState *env, uint32_t *sp, @@ -277,12 +297,14 @@ static void m68k_interrupt_all(CPUM68KState *env, int= is_hw) uint32_t sp; uint32_t vector; uint16_t sr, oldsr; + uint64_t last_pc =3D env->pc; =20 if (!is_hw) { switch (cs->exception_index) { case EXCP_RTE: /* Return from an exception. */ m68k_rte(env); + qemu_plugin_vcpu_exception_cb(cs, last_pc); return; } } @@ -417,6 +439,8 @@ static void m68k_interrupt_all(CPUM68KState *env, int i= s_hw) env->aregs[7] =3D sp; /* Jump to vector. */ env->pc =3D cpu_ldl_mmuidx_ra(env, env->vbr + vector, MMU_KERNEL_IDX, = 0); + + do_plugin_vcpu_interrupt_cb(cs, last_pc); } =20 static void do_interrupt_all(CPUM68KState *env, int is_hw) --=20 2.49.0