From 9c25021e29ee15cf844e48645369bb955954b16c Mon Sep 17 00:00:00 2001 From: Pierrick Bouvier Date: Sat, 12 Oct 2024 10:46:25 -0700 Subject: [PATCH] test plugins_fix_reset Signed-off-by: Pierrick Bouvier --- contrib/plugins/meson.build | 2 +- contrib/plugins/min.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 contrib/plugins/min.c diff --git a/contrib/plugins/meson.build b/contrib/plugins/meson.build index a0e026d25e2d8..ecea6a19bb7d0 100644 --- a/contrib/plugins/meson.build +++ b/contrib/plugins/meson.build @@ -1,7 +1,7 @@ t = [] if get_option('plugins') foreach i : ['cache', 'drcov', 'execlog', 'hotblocks', 'hotpages', 'howvec', - 'hwprofile', 'ips', 'lockstep', 'stoptrigger'] + 'hwprofile', 'ips', 'lockstep', 'stoptrigger', 'min'] if host_os == 'windows' t += shared_module(i, files(i + '.c') + 'win32_linker.c', include_directories: '../../include/qemu', diff --git a/contrib/plugins/min.c b/contrib/plugins/min.c new file mode 100644 index 0000000000000..836e2b2da121d --- /dev/null +++ b/contrib/plugins/min.c @@ -0,0 +1,26 @@ +#include +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; + +qemu_plugin_id_t plugin_id = {0}; + +static void post_reset(qemu_plugin_id_t id) +{ + printf("Reset finished\n"); +} + +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + printf("Translating basic block\n"); + qemu_plugin_reset(plugin_id, post_reset); + printf("Reset request issued\n"); +} + +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, int argc, char **argv) { + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + plugin_id = id; + return 0; +}