diff options
author | Pierrick Bouvier <pierrick.bouvier@linaro.org> | 2024-09-16 09:53:46 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2024-09-19 15:58:01 +0100 |
commit | b709da5d29a8504b7132db0f7614102210aaf997 (patch) | |
tree | b632d20a2554d1f2bc7fd53bc63a5e1df540243e /plugins | |
parent | f63c987b056303c5987ff90fbdb2d4f3c4c9fc14 (diff) | |
download | qemu-b709da5d29a8504b7132db0f7614102210aaf997.zip qemu-b709da5d29a8504b7132db0f7614102210aaf997.tar.gz qemu-b709da5d29a8504b7132db0f7614102210aaf997.tar.bz2 |
plugins: save value during memory accesses
Different code paths handle memory accesses:
- tcg generated code
- load/store helpers
- atomic helpers
This value is saved in cpu->neg.plugin_mem_value_{high,low}. Values are
written only for accessed word size (upper bits are not set).
Atomic operations are doing read/write at the same time, so we generate
two memory callbacks instead of one, to allow plugins to access distinct
values.
For now, we can have access only up to 128 bits, thus split this in two
64 bits words. When QEMU will support wider operations, we'll be able to
reconsider this.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Message-Id: <20240724194708.1843704-2-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20240916085400.1046925-5-alex.bennee@linaro.org>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/core.c b/plugins/core.c index 2897453..bb105e8 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -602,6 +602,8 @@ void exec_inline_op(enum plugin_dyn_cb_type type, } void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { GArray *arr = cpu->neg.plugin_mem_cbs; @@ -610,6 +612,10 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, if (arr == NULL) { return; } + + cpu->neg.plugin_mem_value_low = value_low; + cpu->neg.plugin_mem_value_high = value_high; + for (i = 0; i < arr->len; i++) { struct qemu_plugin_dyn_cb *cb = &g_array_index(arr, struct qemu_plugin_dyn_cb, i); |