mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:56:38 +00:00
plugins: add userdata to qemu_plugin_register_vcpu_resume_cb
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Link: https://lore.kernel.org/qemu-devel/20260615193526.2883349-11-pierrick.bouvier@oss.qualcomm.com Signed-off-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
This commit is contained in:
@@ -78,29 +78,6 @@ void plugin_unregister_cb__locked(struct qemu_plugin_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable CFI checks.
|
||||
* The callback function has been loaded from an external library so we do not
|
||||
* have type information
|
||||
*/
|
||||
QEMU_DISABLE_CFI
|
||||
static void plugin_vcpu_cb__simple(CPUState *cpu, enum qemu_plugin_event ev)
|
||||
{
|
||||
struct qemu_plugin_cb *cb, *next;
|
||||
|
||||
switch (ev) {
|
||||
case QEMU_PLUGIN_EV_VCPU_RESUME:
|
||||
/* iterate safely; plugins might uninstall themselves at any time */
|
||||
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
|
||||
qemu_plugin_vcpu_simple_cb_t func = cb->f.vcpu_simple;
|
||||
func(cpu->cpu_index);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Disable CFI checks.
|
||||
* The callback function has been loaded from an external library so we do not
|
||||
@@ -114,6 +91,7 @@ static void plugin_vcpu_cb__udata(CPUState *cpu, enum qemu_plugin_event ev)
|
||||
switch (ev) {
|
||||
case QEMU_PLUGIN_EV_VCPU_INIT:
|
||||
case QEMU_PLUGIN_EV_VCPU_IDLE:
|
||||
case QEMU_PLUGIN_EV_VCPU_RESUME:
|
||||
case QEMU_PLUGIN_EV_VCPU_EXIT:
|
||||
QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) {
|
||||
qemu_plugin_vcpu_udata_cb_t func = cb->f.vcpu_udata;
|
||||
@@ -636,7 +614,7 @@ void qemu_plugin_vcpu_resume_cb(CPUState *cpu)
|
||||
{
|
||||
if (cpu->cpu_index < plugin.num_vcpus) {
|
||||
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS_PC);
|
||||
plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME);
|
||||
plugin_vcpu_cb__udata(cpu, QEMU_PLUGIN_EV_VCPU_RESUME);
|
||||
qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS);
|
||||
}
|
||||
}
|
||||
@@ -667,9 +645,10 @@ void qemu_plugin_register_vcpu_idle_cb(qemu_plugin_id_t id,
|
||||
}
|
||||
|
||||
void qemu_plugin_register_vcpu_resume_cb(qemu_plugin_id_t id,
|
||||
qemu_plugin_vcpu_simple_cb_t cb)
|
||||
qemu_plugin_vcpu_udata_cb_t cb,
|
||||
void *userdata)
|
||||
{
|
||||
plugin_register_cb(id, QEMU_PLUGIN_EV_VCPU_RESUME, cb);
|
||||
plugin_register_cb_udata(id, QEMU_PLUGIN_EV_VCPU_RESUME, cb, userdata);
|
||||
}
|
||||
|
||||
void qemu_plugin_register_vcpu_discon_cb(qemu_plugin_id_t id,
|
||||
|
||||
Reference in New Issue
Block a user