From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DBFA7CCF9EC for ; Mon, 27 Oct 2025 11:07:39 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vDL2R-0001gz-J1; Mon, 27 Oct 2025 07:05:23 -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 1vDL2E-0001NQ-Bd for qemu-arm@nongnu.org; Mon, 27 Oct 2025 07:05:10 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vDL1Z-0005g6-AD for qemu-arm@nongnu.org; Mon, 27 Oct 2025 07:05:09 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-63bdfd73e6eso10284692a12.0 for ; Mon, 27 Oct 2025 04:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1761563036; x=1762167836; 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=6tc/ncHQ43H5RAM4g98aEerDqB5nJ7XC9XRTlxHTgjE=; b=RC6W0lZoe2DPpgJuvPbnkpvI2CHFJov4P0RbMXSvPm5HiBQeFPMU0tGjvk1zxiVRET jhJMbdR6idwvZX3aHQREyEDAHhx085ycv1byqAWs4uwawbAMwPjmT/otbcOOTBZccD7M EV4FqvKtJ/oOV5gbVkR/QKr722By5jaOjkaTmB3iF4320yERYvkYadfvKwJjIdR3qL5f NQo1t+HspSB+QYfao4l82rlR01T8yr4hz12E5phYJbNQUQvu/qnx7GWKtKhujEt4hoSu lOULW40XFfd5detS3bPn73JF88QKM4rFezPilpqVPGhhJ91Ljcc/hRxMpkMuMQ0mmeOo Trkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761563036; x=1762167836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6tc/ncHQ43H5RAM4g98aEerDqB5nJ7XC9XRTlxHTgjE=; b=lVymdJKBov0+DcegLWT74kPKeR4AxfGZ1LzyOkuJ++ewUsddXiuX4TIoMsn2IUdigs Q+++29knMkpQrTBDN6AtkY+ZAKIxECWgb/iXuf55CFteMIx3bmaz2JjcsiUzO1OwvJRj zk55j6DB8z1n7y+bhTAxlr221AnxAZBpPtRyLOoOrLJYl/Uynh3xxOc5qBsq+/xiBgLi a/lvRoxcQn5bKrxxjafIGU5J0SvK0OZMl0nGiZZoDS4MHopmo0LdX3nDb9S02ancZGX8 BjuOZPI8COFB0N1WPEWYuEuBfax7bWUfgS+4dMLmS3iQ1era1etNOIhLBL5ZGlQMyLe7 VMnA== X-Forwarded-Encrypted: i=1; AJvYcCU3ttj8uHUMenzdPjgfK2CtheiicSsCpvcTlCr2ySngWpdqMMXmNUAGLYLPOP21kS2LFluscc9bAw==@nongnu.org X-Gm-Message-State: AOJu0YwescTBuHe8Gy6qLeaCQfdCbiutzUmc8p9/kZGEgZeWKUI9umTR ePEcCegNiHSkKP3x/V5UWUSx2476FZqlVYk9We6jyX3EzwWSzIVo8Nk2WegmskbwrKk= X-Gm-Gg: ASbGncuXX7FPUJq3wyC+su8C/6TMbwev66+ilsa38KFfFpXeWlY6d/n2KuM/NJzTUgg G4AQYIENvFxLPCk+nCBpWIpDAiyZwrlTM3nW3pQ+dy2t0IposNGsB29Bx5YEiSCtLMCjdYlgOQF Gkr5yiooqQbh5FcCAv+xhKTqCksz5w82CXWe6RscjIkE++b/25W0fhrCtWBeWk1djMv9SffOGNz 84u+FbpGq7kP1WpRj52naLLvOg3PQIm6sW4ODUu5BU+iUCXzs7zI8JmjhJwXDJiIo0OEbkOd1gZ 999HbAiGHMXdPfEtIAA+ffv8xEmeUtta/ETTmgoLCQ+9uT8crDnjLlKZkX2n6FRz8fq9610mjpg vUI0DrgSoZmwgnRzjyscZ5oKUIF+bvfo3off09z9ORx8bHV3LDsfWOC/BBoqyCOCCXBSKn1ykG+ TGzqIu9UCk0hI= X-Google-Smtp-Source: AGHT+IERY0LRDtAh/P/JnbkEdSaGPZN26CjXuTfwQxfSVQ5HKYkzM6nMMAvqidpDE39wy9t9gsU+wA== X-Received: by 2002:aa7:cf0a:0:b0:63e:6f85:1ef3 with SMTP id 4fb4d7f45d1cf-63e6f851f34mr5947239a12.12.1761563036495; Mon, 27 Oct 2025 04:03:56 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-63e7efb950csm6163591a12.28.2025.10.27.04.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Oct 2025 04:03:53 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7AA5F60A94; Mon, 27 Oct 2025 11:03:45 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Liu Zhiwei , Alexandre Iooss , Chinmay Rath , qemu-arm@nongnu.org, Peter Maydell , Nicholas Piggin , Ilya Leoshkevich , David Hildenbrand , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-s390x@nongnu.org, Pierrick Bouvier , Bastian Koppelmann , Helge Deller , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Stafford Horne , Mahmoud Mandour , Artyom Tarasenko , Eduardo Habkost , Palmer Dabbelt , Alistair Francis , Laurent Vivier , Weiwei Li , Daniel Henrique Barboza , Mark Cave-Ayland , Yoshinori Sato , "Edgar E. Iglesias" , Aurelien Jarno , Richard Henderson , Thomas Huth , Max Filippov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Jiaxun Yang , Michael Rolnik , Song Gao , qemu-riscv@nongnu.org, Aleksandar Rikalo , Julian Ganz Subject: [PATCH 15/35] target/i386: call plugin trap callbacks Date: Mon, 27 Oct 2025 11:03:22 +0000 Message-ID: <20251027110344.2289945-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251027110344.2289945-1-alex.bennee@linaro.org> References: <20251027110344.2289945-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-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 autolearn=unavailable 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org From: Julian Ganz 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é Signed-off-by: Alex Bennée --- 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 6fb8036d988..32f2784e923 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" 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 = env_cpu(env); + uint64_t last_pc = env->eip + env->segs[R_CS].base; 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 = error_code; env->exception_is_int = is_int; env->exception_next_eip = env->eip + next_eip_addend; + qemu_plugin_vcpu_exception_cb(cs, last_pc); cpu_loop_exit_restore(cs, retaddr); } diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c index f49fe851cdf..667b1c38696 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" #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 = &cpu->env; + uint64_t last_pc = env->eip + env->segs[R_CS].base; 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); } void do_interrupt_x86_hardirq(CPUX86State *env, int intno, int is_hw) -- 2.47.3