From: Florian Hofhammer <florian.hofhammer@epfl.ch>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, pierrick.bouvier@linaro.org,
richard.henderson@linaro.org, laurent@vivier.eu, imp@bsdimp.com,
berrange@redhat.com
Subject: [RFC PATCH v2 0/2] Enable PC diversion via the plugin API
Date: Mon, 6 Oct 2025 15:21:21 +0200 [thread overview]
Message-ID: <e9bcd7c7-2d67-469e-b2f3-d1a68e456b2b@epfl.ch> (raw)
Hi,
As originally discussed in the thread at
https://lists.nongnu.org/archive/html/qemu-devel/2025-08/msg00656.html
and later proposed in a patch at
https://lists.nongnu.org/archive/html/qemu-devel/2025-09/msg02218.html,
I am sending an updated version of my patch based on the previous
feedback.
Notable changes to v1:
- Added a setjmp() in the syscall handling path to allow redirecting
the PC via cpu_loop_exit() also in syscall callbacks. The previous
version would only work in instruction execution / memory access
callback contexts, as the setjmp() corresponding to the longjmp() in
cpu_loop_exit() was only live in those contexts.
- Added a flag to make sure the new API function is only called in
contexts where it makes sense, i.e., during execution of guest code.
- Added a test that checks the new functionality by skipping a
non-existent sentinel syscall.
I made it an RFC patch this time as I am not entirely sure if my
setting/handling of the new flag makes sense the way it is. I briefly
looked into making the QEMU_PLUGIN_CB_* flags actual flags via a
bitfield instead of enum values, but that would have required touching
a lot of code all over the place, so I'm not sure this is the way to go.
Happy to get feedback and your thoughts on the patches!
Thanks,
Florian
Florian Hofhammer (2):
plugins: Add PC diversion API function
tests/tcg: add test for qemu_plugin_set_pc API
include/qemu/qemu-plugin.h | 15 +++++++
linux-user/aarch64/cpu_loop.c | 2 +-
linux-user/alpha/cpu_loop.c | 2 +-
linux-user/arm/cpu_loop.c | 2 +-
linux-user/hexagon/cpu_loop.c | 2 +-
linux-user/hppa/cpu_loop.c | 4 ++
linux-user/i386/cpu_loop.c | 8 ++--
linux-user/include/special-errno.h | 8 ++++
linux-user/loongarch64/cpu_loop.c | 5 ++-
linux-user/m68k/cpu_loop.c | 2 +-
linux-user/microblaze/cpu_loop.c | 2 +-
linux-user/mips/cpu_loop.c | 5 ++-
linux-user/openrisc/cpu_loop.c | 2 +-
linux-user/ppc/cpu_loop.c | 6 ++-
linux-user/riscv/cpu_loop.c | 2 +-
linux-user/s390x/cpu_loop.c | 2 +-
linux-user/sh4/cpu_loop.c | 2 +-
linux-user/sparc/cpu_loop.c | 4 +-
linux-user/syscall.c | 8 ++++
linux-user/xtensa/cpu_loop.c | 3 ++
plugins/api.c | 17 +++++++-
plugins/core.c | 25 ++++++-----
tests/tcg/multiarch/Makefile.target | 42 +++++++++++++++++++
.../tcg/multiarch/test-plugin-skip-syscalls.c | 26 ++++++++++++
tests/tcg/plugins/syscall.c | 6 +++
25 files changed, 170 insertions(+), 32 deletions(-)
create mode 100644 tests/tcg/multiarch/test-plugin-skip-syscalls.c
--
2.51.0
next reply other threads:[~2025-10-06 13:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 13:21 Florian Hofhammer [this message]
2025-10-06 13:22 ` [RFC PATCH v2 1/2] plugins: Add PC diversion API function Florian Hofhammer
2025-10-06 13:23 ` [RFC PATCH v2 2/2] tests/tcg: add test for qemu_plugin_set_pc API Florian Hofhammer
2025-10-29 15:57 ` [RFC PATCH v2 0/2] Enable PC diversion via the plugin API Florian Hofhammer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e9bcd7c7-2d67-469e-b2f3-d1a68e456b2b@epfl.ch \
--to=florian.hofhammer@epfl.ch \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=imp@bsdimp.com \
--cc=laurent@vivier.eu \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).