From nobody Fri Nov 14 18:21:15 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=1760887040; cv=none; d=zohomail.com; s=zohoarc; b=VVR4anhs4/YfOgUcOKs4RDckl9y4zTkkU9J0txiZ/+5FIg+URfTu4/DvXP6olcL+udZNc6hPy+uAO36R7xd2YSt6oDN36kYidvGn0h8pK68IaJwz9xZMBw66N3LKqnrM0ZUTv8/brv/psi7V9by9pLAvYyxMrUpd0Ijw46S7G0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760887040; 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=sc5uheGlvDe71sMUdhs9jRIJnXn+lApevkwQ2tIJQe4=; b=OFxcMNLgbFcFNcPQtyZnzFyztcoB3GXete+rqtBh0HyGQDgvV3Yxt7QXiD2/vexuJhGqusfNSRB42YfD+KnVcLGNurBn7dEnRLe+pnuTlO24itCx7ksu5EizjyQru6c/PWQhxXqZrbFgDKsJKO4JckdASn6NVwg5GweDC0n9Wcg= 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 1760887040210746.3871648323352; Sun, 19 Oct 2025 08:17:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vAV9C-0001yB-Od; Sun, 19 Oct 2025 11:16:38 -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 1vAV9B-0001wR-5m for qemu-devel@nongnu.org; Sun, 19 Oct 2025 11:16:37 -0400 Received: from mailgate01.uberspace.is ([95.143.172.20]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vAV99-0003Ba-7a for qemu-devel@nongnu.org; Sun, 19 Oct 2025 11:16:36 -0400 Received: from skiff.uberspace.de (skiff.uberspace.de [185.26.156.131]) by mailgate01.uberspace.is (Postfix) with ESMTPS id 1777560A6C for ; Sun, 19 Oct 2025 17:16:34 +0200 (CEST) Received: (qmail 23134 invoked by uid 990); 19 Oct 2025 15:16:34 -0000 Received: from unknown (HELO unkown) (::1) by skiff.uberspace.de (Haraka/3.0.1) with ESMTPSA; Sun, 19 Oct 2025 17:16:33 +0200 Authentication-Results: skiff.uberspace.de; auth=pass (plain) From: Julian Ganz To: qemu-devel@nongnu.org Cc: Julian Ganz , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH v8 09/25] target/i386: call plugin trap callbacks Date: Sun, 19 Oct 2025 17:14:58 +0200 Message-ID: <5fb50dd708c97604112c95fcf33045cfe215901a.1760884672.git.neither@nut.email> X-Mailer: git-send-email 2.49.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.999997) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.599997 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nut.email; s=uberspace; h=from:to:cc:subject:date; bh=4wIyJdUT0Wq/HXsJOsBJPGZgllzvhv7UsSxinsdLJ6s=; b=PbfI4ZPKQRz4TJLXwGDwL+8wZ8cSZIYv666sDlb4D6SbxeXOF94owcdb1mZtv5iLdDRvBI4EpD h6kXWtRKuS5c9OqFq552nA+Epm+t61zbnfzrke9195Q/YKaPJUNy7n70gzuG7TokPdpFqiGjc+kq 2xHUV41noLSdHjrpZFXbP+Cj6O5zI6w+927XjuZVqGfq3moB4iQOY6kfN92npWvycOSo+Pr8nlRA 2bMxDBvMVZQc/uus7bkkCsLizHD2HQBcqCV9HBALhjVIvXYw8k+u1g0nRYGEBTCQNL9L/SHQL+T5 1DtKIiq0G7MtMEW9UCOVDDpGhle1DA+8KTOVdAjk6oNy3DiKVI2UgB0fqzBzaWhI5lCgFIusbVld OOFTo+/9LsgJfKLwckq2kyjYsvGw0cH/Y+eNkNjaSp/Odx43wLCTi0yav7aBMnA3s0BVQH7mplG5 rnXLnOts7Py1tYN9NxK6ZhnvkEUcA4W/BSqfGGr1GO7NIITDQ33mNbZT8iy5TmPmwl743IUwK6Mi zBvKHFnkOHtz+dHSCinXp+oqsECtM0PdcRDUa0eSf7XYFtU3riFAjh1p5t6SiTX9LrA6TPxntXh1 Tw8P3iXNOwHNQaNKcY1nLqLtQ6kmy+EIs+5kYJ9y1bgFxQfyWKScF1AfpDuQVxFuNWwYh8x1il7M A= 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=95.143.172.20; envelope-from=neither@nut.email; helo=mailgate01.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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, 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: 1760887043824158500 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 the hook for x86 targets. Signed-off-by: Julian Ganz Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/tcg/excp_helper.c | 3 +++ target/i386/tcg/seg_helper.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/target/i386/tcg/excp_helper.c b/target/i386/tcg/excp_helper.c index 6fb8036d98..32f2784e92 100644 --- a/target/i386/tcg/excp_helper.c +++ b/target/i386/tcg/excp_helper.c @@ -23,6 +23,7 @@ #include "system/runstate.h" #include "exec/helper-proto.h" #include "helper-tcg.h" +#include "qemu/plugin.h" =20 G_NORETURN void helper_raise_interrupt(CPUX86State *env, int intno, int next_eip_addend) @@ -93,6 +94,7 @@ void raise_interrupt2(CPUX86State *env, int intno, uintptr_t retaddr) { CPUState *cs =3D env_cpu(env); + uint64_t last_pc =3D env->eip + env->segs[R_CS].base; =20 if (!is_int) { cpu_svm_check_intercept_param(env, SVM_EXIT_EXCP_BASE + intno, @@ -106,6 +108,7 @@ void raise_interrupt2(CPUX86State *env, int intno, env->error_code =3D error_code; env->exception_is_int =3D is_int; env->exception_next_eip =3D env->eip + next_eip_addend; + qemu_plugin_vcpu_exception_cb(cs, last_pc); cpu_loop_exit_restore(cs, retaddr); } =20 diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index f49fe851cd..667b1c3869 100644 --- a/target/i386/tcg/seg_helper.c +++ b/target/i386/tcg/seg_helper.c @@ -29,6 +29,7 @@ #include "seg_helper.h" #include "access.h" #include "tcg-cpu.h" +#include "qemu/plugin.h" =20 #ifdef TARGET_X86_64 #define SET_ESP(val, sp_mask) \ @@ -1192,6 +1193,7 @@ void do_interrupt_all(X86CPU *cpu, int intno, int is_= int, int error_code, target_ulong next_eip, int is_hw) { CPUX86State *env =3D &cpu->env; + uint64_t last_pc =3D env->eip + env->segs[R_CS].base; =20 if (qemu_loglevel_mask(CPU_LOG_INT)) { if ((env->cr[0] & CR0_PE_MASK)) { @@ -1263,6 +1265,8 @@ void do_interrupt_all(X86CPU *cpu, int intno, int is_= int, event_inj & ~SVM_EVTINJ_VALID); } #endif + + qemu_plugin_vcpu_interrupt_cb(CPU(cpu), last_pc); } =20 void do_interrupt_x86_hardirq(CPUX86State *env, int intno, int is_hw) --=20 2.49.1