qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/2] Enable PC diversion via the plugin API
@ 2025-10-06 13:21 Florian Hofhammer
  2025-10-06 13:22 ` [RFC PATCH v2 1/2] plugins: Add PC diversion API function Florian Hofhammer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Florian Hofhammer @ 2025-10-06 13:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: alex.bennee, pierrick.bouvier, richard.henderson, laurent, imp,
	berrange

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-29 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-06 13:21 [RFC PATCH v2 0/2] Enable PC diversion via the plugin API Florian Hofhammer
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

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).