to
permit a specified address space, for example to facilitate
architecture-specific plugins that want to operate on them, for example
reading ARM secure memory.
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 93
plugins
x27;t currently
in the context of the plugin.
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 21 +
plugins/api.c | 18 ++
2 files changed, 39 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu
: novafacing
Signed-off-by: Rowan Hart
---
tests/tcg/Makefile.target | 1 +
tests/tcg/plugins/meson.build | 2 +-
tests/tcg/plugins/patch.c | 302 ++
tests/tcg/x86_64/Makefile.softmmu-target | 32 ++-
tests/tcg/x86_64/system/patch
of these functions in the future if we change our minds!
Rowan Hart (2):
plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W
callbacks
plugins: Remove use of qemu_plugin_read_register where it is not
permitted
novafacing (7):
gdbstub: Expose gdb_write_register functio
From: novafacing
This patch adds a plugin that implements a simple form of hypercalls
from guest code to the plugin by using the register read API. It accepts
only one hypercall, which writes a magic value to guest memory.
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
tests/tcg
functions (in particular, the register read and write API)
will call qemu_plugin_get_cb_flags() to check the level is at least the
level they require.
Signed-off-by: Rowan Hart
---
accel/tcg/plugin-gen.c | 27 +
include/qemu/plugin.h | 12
include/qemu/qemu-plugin.h
flags are enforced and qemu_plugin_read_register
can no longer be called from a vcpu_init callback because it does not
request the QEMU_PLUGIN_CB_ flag (nor does it have a mechanism to do
so).
Signed-off-by: Rowan Hart
---
tests/tcg/plugins/insn.c | 22 +-
1 file changed, 1
From: novafacing
This patch adds a function to the plugins API to allow plugins to write
register contents. It also moves the qemu_plugin_read_register function
so all the register-related functions are grouped together in the file.
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
From: novafacing
This patch exposes the gdb_write_register function from
gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in
plugins to write register contents.
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
gdbstub/gdbstub.c | 2 +-
include/exec/gdbstub.h
From: novafacing
This patch updates the plugin version to gate new APIs and adds notes
describing what has been added.
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 9 -
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu
>
>
> > This definition strikes me as odd. What was your reason to assert
> > `current_cpu` here, but not in the other two functions? Also a bit
> > surprising is the declaration of `cpu` if you use it in just one place
> > (rather than just use `current_cpu` directly as for the assertion).
> >
> >
> a) handle the QEMU_PLUGIN_CB_RW_REGS
I missed that this was not already handled. I'll fix that.
> b) try and enforce we are only being called from such callbacks
Sure, beyond documentation I suppose we can add and check a flag to ensure
this. I think it's a good idea to reduce foot guns from
Hi Julian,
> Again, what was the reason for moving `qemu_plugin_read_register`?
I moved it so it's grouped with get_registers above instead of being
separated below the memory functions. I can move it back, just seemed nicer
that way.
-Rowan
On Thu, May 22, 2025, 4:59 AM Julian Ganz wrote:
>
Well, first I just noticed that I left a debug print in this function!
So I'll fix that.
Reading this patch, and patch 3 (Add address space API), I am not sure
AddressSpace is something we want to leak in plugins interface.
It is a concept *very* internal to QEMU, and not reflecting directly
s
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 57 +-
plugins/api.c | 26 -
2 files changed, 56 insertions(+), 27 deletions(-)
diff --git a/include/qemu/qemu-plugin.h b
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
gdbstub/gdbstub.c | 2 +-
include/exec/gdbstub.h | 14 ++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 565f6b33a9..5846e481be 100644
--- a
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
tests/tcg/Makefile.target | 1 +
tests/tcg/plugins/hypercalls.c| 552 ++
tests/tcg/plugins/meson.build | 2 +-
tests/tcg/x86_64/Makefile.softmmu
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/plugin.h | 6 +++
include/qemu/qemu-plugin.h | 45 ++
plugins/api.c | 79 ++
3 files changed, 130 insertions(+)
diff --git a
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
tests/tcg/Makefile.target | 1 +
tests/tcg/plugins/meson.build | 2 +-
tests/tcg/plugins/patch.c | 324 ++
tests/tcg/x86_64/Makefile.softmmu-target
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 96 +++
plugins/api.c | 100 +
2 files changed, 196 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b
This patch series adds several new API functions focused on enabling use
cases around reading and writing guest memory from QEMU plugins. To support
these new APIs, some utility functionality around retrieving information about
address spaces is added as well.
The new qemu_plugin_write_register ut
From: novafacing
Signed-off-by: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 21 +
plugins/api.c | 18 ++
2 files changed, 39 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index
From: novafacing
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 12 +++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index d4f229abd9..4cf2955560 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include
>> +++ b/tests/tcg/plugins/inject.c
>
> Could we find a better name?
For sure, maybe "hypercalls.c" since that's really what it's mostly about.
>> @@ -0,0 +1,206 @@
>> +/*
>> + * Copyright (C) 2024, Rowan Hart
>> + *
>> + * Licen
> I am personally in favor to adding such features in upstream QEMU, but we
> should discuss it with the maintainers, because it would allow to change the
> state of execution, which is something qemu plugins actively didn't try to
> do. It's a real paradigm shift for plugins.
>
> By writing to
From: novafacing
---
gdbstub/gdbstub.c | 2 +-
include/exec/gdbstub.h | 14 ++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index b1def7e71d..7d87a3324c 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -536,7 +536
tests/tcg/plugins/inject.c
create mode 100644 tests/tcg/x86_64/inject-target.c
diff --git a/tests/tcg/plugins/inject.c b/tests/tcg/plugins/inject.c
new file mode 100644
index 00..9edc2cd34e
--- /dev/null
+++ b/tests/tcg/plugins/inject.c
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2024, Rowan
From: novafacing
---
include/qemu/qemu-plugin.h | 116 +
plugins/api.c | 66 -
2 files changed, 168 insertions(+), 14 deletions(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 0fba36ae02..b812593
This patch set follows a previous patch which added the
qemu_plugin_read_memory_vaddr function and adds a set of similar
functions to read and write registers, virtual memory, and
physical memory.
The use case I have in mind is for use of QEMU for program analysis and
testing. For example, a fuzze
From: novafacing
---
include/qemu/qemu-plugin.h | 116 +
plugins/api.c | 66 -
2 files changed, 168 insertions(+), 14 deletions(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index 0fba36ae02..b812593
This patch set follows a previous patch which added the
qemu_plugin_read_memory_vaddr function and adds a set of similar
functions to read and write registers, virtual memory, and
physical memory.
The use case I have in mind is for use of QEMU for program analysis and
testing. For example, a fuzze
From: novafacing
---
gdbstub/gdbstub.c | 2 +-
include/exec/gdbstub.h | 14 ++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index b1def7e71d..7d87a3324c 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -536,7 +536
>
> See:
>
> tests/tcg/i386/system/boot.S
> tests/tcg/alpha/system/boot.S
> tests/tcg/loongarch64/system/boot.S
> tests/tcg/aarch64/system/boot.S
> tests/tcg/x86_64/system/boot.S
> tests/tcg/arm/system/boot.S
>
> for what is needed (basically a MMU-enabled flat memory map and some
>
00 00 00 00 00 00 00 00 00 00 00 00 00 |
Hello, RISC-V!
For v2, removes a symbol left in qemu-plugins.symbols accidentally.
Rowan Hart (1):
plugins: add API to read guest CPU memory from hwaddr
include/qemu/qemu-plugin.h | 22 ++
plugins/
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 22 ++
plugins/api.c| 17 +
plugins/qemu-plugins.symbols | 1 +
3 files changed, 40 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index
> + qemu_plugin_read_cpu_memory_hwaddr;
> + qemu_plugin_read_io_memory_hwaddr;
This second symbol name should be removed, I initially wanted to implement
for IO as well but there is no good generic way I can see to access a list
of IO AddressSpace to read from.
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 22 ++
plugins/api.c| 17 +
plugins/qemu-plugins.symbols | 2 ++
3 files changed, 41 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index
00 00 00 00 00 00 00 00 00 00 00 00 00 |
Hello, RISC-V!
Rowan Hart (1):
plugins: add API to read guest CPU memory from hwaddr
include/qemu/qemu-plugin.h | 22 ++
plugins/api.c| 17 +
plugins/qemu-plugins.symbols | 2 ++
3
Signed-off-by: Rowan Hart
Reviewed-by: Pierrick Bouvier
Tested-by: Pierrick Bouvier
---
docs/about/emulation.rst| 14 -
tests/tcg/plugins/syscall.c | 117
2 files changed, 130 insertions(+), 1 deletion(-)
diff --git a/docs/about/emulation.rst b
doc build issue.
Rowan Hart (2):
plugins: add plugin API to read guest memory
plugins: add option to dump write argument to syscall plugin
docs/about/emulation.rst | 14 -
include/qemu/qemu-plugin.h | 32 +-
plugins/api.c| 20 ++
plugins/qemu-plugi
Signed-off-by: Rowan Hart
Reviewed-by: Pierrick Bouvier
---
include/qemu/qemu-plugin.h | 32 +++-
plugins/api.c| 20
plugins/qemu-plugins.symbols | 1 +
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/include
Signed-off-by: Rowan Hart
---
docs/about/emulation.rst| 14 -
tests/tcg/plugins/syscall.c | 117
2 files changed, 130 insertions(+), 1 deletion(-)
diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst
index eea1261baa..e85d494ff0 100644
Signed-off-by: Rowan Hart
---
include/qemu/qemu-plugin.h | 32 +++-
plugins/api.c| 20
plugins/qemu-plugins.symbols | 1 +
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu
)
* Accurate and easier execution trace extraction
* Debugging and logging tools
An example of its use is added to the existing syscalls plugin,
which now has an option to hexdump the buf argument to any write(2)
syscalls which occur.
Rowan Hart (2):
plugins: add plugin API to read guest memory
Alex,
Thanks for the additional information.
>>
>> A key aspect of what you propose here, is that the memory may have
>> changed during the write time, and when you read it, while what we
>> propose guarantees to track every change correctly.
>>
>> It's not a bad thing, and both API are definitel
Alex & Pierrick,
Thank you for the feedback! This is my first contribution to QEMU, so I'm glad
it at least passes the initial smell test :)
> I'll make my comments in this patch, but for v2, please split those individual
> commits, and a cover letter, describing your changes (https://github.com/
Signed-off-by: Rowan Hart
---
docs/about/emulation.rst | 16 -
include/qemu/qemu-plugin.h | 24 +++-
plugins/api.c| 21 +++
plugins/qemu-plugins.symbols | 1 +
tests/tcg/plugins/mem.c | 37 +++-
tests/tcg/plugins/syscall.c | 113
Hi all, this is my first post to the mailing list! I've spent the last
couple weeks building QEMU Rust crates to enable a couple goals:
- Install QEMU binaries using cargo, the Rust package manager
- Use git-latest QEMU binaries in Rust projects as a dependency
- Write QEMU TCG plugins entirely in
48 matches
Mail list logo