mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
plugins: conditional callbacks
Extend plugins API to support callback called with a given criteria (evaluated inline). Added functions: - qemu_plugin_register_vcpu_tb_exec_cond_cb - qemu_plugin_register_vcpu_insn_exec_cond_cb They expect as parameter a condition, a qemu_plugin_u64_t (op1) and an immediate (op2). Callback is called if op1 |cond| op2 is true. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240502211522.346467-6-pierrick.bouvier@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> [AJB: fix re-base conflict with tb_is_mem_only()] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240514174253.694591-8-alex.bennee@linaro.org>
This commit is contained in:
parent
a1c9bf2514
commit
7de77d3788
7 changed files with 213 additions and 0 deletions
|
@ -371,6 +371,38 @@ void plugin_register_dyn_cb__udata(GArray **arr,
|
|||
dyn_cb->regular.info = &info[flags];
|
||||
}
|
||||
|
||||
void plugin_register_dyn_cond_cb__udata(GArray **arr,
|
||||
qemu_plugin_vcpu_udata_cb_t cb,
|
||||
enum qemu_plugin_cb_flags flags,
|
||||
enum qemu_plugin_cond cond,
|
||||
qemu_plugin_u64 entry,
|
||||
uint64_t imm,
|
||||
void *udata)
|
||||
{
|
||||
static TCGHelperInfo info[3] = {
|
||||
[QEMU_PLUGIN_CB_NO_REGS].flags = TCG_CALL_NO_RWG,
|
||||
[QEMU_PLUGIN_CB_R_REGS].flags = TCG_CALL_NO_WG,
|
||||
/*
|
||||
* Match qemu_plugin_vcpu_udata_cb_t:
|
||||
* void (*)(uint32_t, void *)
|
||||
*/
|
||||
[0 ... 2].typemask = (dh_typemask(void, 0) |
|
||||
dh_typemask(i32, 1) |
|
||||
dh_typemask(ptr, 2))
|
||||
};
|
||||
|
||||
struct qemu_plugin_dyn_cb *dyn_cb = plugin_get_dyn_cb(arr);
|
||||
dyn_cb->userp = udata;
|
||||
dyn_cb->type = PLUGIN_CB_COND;
|
||||
dyn_cb->cond.f.vcpu_udata = cb;
|
||||
dyn_cb->cond.cond = cond;
|
||||
dyn_cb->cond.entry = entry;
|
||||
dyn_cb->cond.imm = imm;
|
||||
|
||||
assert((unsigned)flags < ARRAY_SIZE(info));
|
||||
dyn_cb->cond.info = &info[flags];
|
||||
}
|
||||
|
||||
void plugin_register_vcpu_mem_cb(GArray **arr,
|
||||
void *cb,
|
||||
enum qemu_plugin_cb_flags flags,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue