diff options
| author | Pierrick Bouvier <pierrick.bouvier@linaro.org> | 2024-05-14 18:42:51 +0100 |
|---|---|---|
| committer | Alex Bennée <alex.bennee@linaro.org> | 2024-05-16 08:55:23 +0100 |
| commit | f86fd4d8721073fa834845c5b76bf1f829b5f9b5 (patch) | |
| tree | ad9a0e58528dfb600a06b434a76d520bbc127ecb /include/qemu/plugin.h | |
| parent | 544595e73007c824b7435b52519cc578586783a6 (diff) | |
| download | focaccia-qemu-f86fd4d8721073fa834845c5b76bf1f829b5f9b5.tar.gz focaccia-qemu-f86fd4d8721073fa834845c5b76bf1f829b5f9b5.zip | |
plugins: distinct types for callbacks
To prevent errors when writing new types of callbacks or inline operations, we split callbacks data to distinct types. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240502211522.346467-8-pierrick.bouvier@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240514174253.694591-10-alex.bennee@linaro.org>
Diffstat (limited to 'include/qemu/plugin.h')
| -rw-r--r-- | include/qemu/plugin.h | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 2b126e1884..0c9e4f981e 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -74,34 +74,40 @@ enum plugin_dyn_cb_type { PLUGIN_CB_INLINE_STORE_U64, }; +struct qemu_plugin_regular_cb { + union qemu_plugin_cb_sig f; + TCGHelperInfo *info; + void *userp; + enum qemu_plugin_mem_rw rw; +}; + +struct qemu_plugin_inline_cb { + qemu_plugin_u64 entry; + enum qemu_plugin_op op; + uint64_t imm; + enum qemu_plugin_mem_rw rw; +}; + +struct qemu_plugin_conditional_cb { + union qemu_plugin_cb_sig f; + TCGHelperInfo *info; + void *userp; + qemu_plugin_u64 entry; + enum qemu_plugin_cond cond; + uint64_t imm; +}; + /* * A dynamic callback has an insertion point that is determined at run-time. * Usually the insertion point is somewhere in the code cache; think for * instance of a callback to be called upon the execution of a particular TB. */ struct qemu_plugin_dyn_cb { - void *userp; enum plugin_dyn_cb_type type; - /* @rw applies to mem callbacks only (both regular and inline) */ - enum qemu_plugin_mem_rw rw; - /* fields specific to each dyn_cb type go here */ union { - struct { - union qemu_plugin_cb_sig f; - TCGHelperInfo *info; - } regular; - struct { - union qemu_plugin_cb_sig f; - TCGHelperInfo *info; - qemu_plugin_u64 entry; - enum qemu_plugin_cond cond; - uint64_t imm; - } cond; - struct { - qemu_plugin_u64 entry; - enum qemu_plugin_op op; - uint64_t imm; - } inline_insn; + struct qemu_plugin_regular_cb regular; + struct qemu_plugin_conditional_cb cond; + struct qemu_plugin_inline_cb inline_insn; }; }; |