plugins: remove op from qemu_plugin_inline_cb
This field is not needed as the callback type already holds this information. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240502211522.346467-10-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-12-alex.bennee@linaro.org>
This commit is contained in:
parent
b95b78dc16
commit
09afe9677e
@ -83,7 +83,6 @@ struct qemu_plugin_regular_cb {
|
|||||||
|
|
||||||
struct qemu_plugin_inline_cb {
|
struct qemu_plugin_inline_cb {
|
||||||
qemu_plugin_u64 entry;
|
qemu_plugin_u64 entry;
|
||||||
enum qemu_plugin_op op;
|
|
||||||
uint64_t imm;
|
uint64_t imm;
|
||||||
enum qemu_plugin_mem_rw rw;
|
enum qemu_plugin_mem_rw rw;
|
||||||
};
|
};
|
||||||
|
@ -338,7 +338,6 @@ void plugin_register_inline_op_on_entry(GArray **arr,
|
|||||||
|
|
||||||
struct qemu_plugin_inline_cb inline_cb = { .rw = rw,
|
struct qemu_plugin_inline_cb inline_cb = { .rw = rw,
|
||||||
.entry = entry,
|
.entry = entry,
|
||||||
.op = op,
|
|
||||||
.imm = imm };
|
.imm = imm };
|
||||||
dyn_cb = plugin_get_dyn_cb(arr);
|
dyn_cb = plugin_get_dyn_cb(arr);
|
||||||
dyn_cb->type = op_to_cb_type(op);
|
dyn_cb->type = op_to_cb_type(op);
|
||||||
@ -557,7 +556,9 @@ void qemu_plugin_flush_cb(void)
|
|||||||
plugin_cb__simple(QEMU_PLUGIN_EV_FLUSH);
|
plugin_cb__simple(QEMU_PLUGIN_EV_FLUSH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void exec_inline_op(struct qemu_plugin_inline_cb *cb, int cpu_index)
|
void exec_inline_op(enum plugin_dyn_cb_type type,
|
||||||
|
struct qemu_plugin_inline_cb *cb,
|
||||||
|
int cpu_index)
|
||||||
{
|
{
|
||||||
char *ptr = cb->entry.score->data->data;
|
char *ptr = cb->entry.score->data->data;
|
||||||
size_t elem_size = g_array_get_element_size(
|
size_t elem_size = g_array_get_element_size(
|
||||||
@ -565,11 +566,11 @@ void exec_inline_op(struct qemu_plugin_inline_cb *cb, int cpu_index)
|
|||||||
size_t offset = cb->entry.offset;
|
size_t offset = cb->entry.offset;
|
||||||
uint64_t *val = (uint64_t *)(ptr + offset + cpu_index * elem_size);
|
uint64_t *val = (uint64_t *)(ptr + offset + cpu_index * elem_size);
|
||||||
|
|
||||||
switch (cb->op) {
|
switch (type) {
|
||||||
case QEMU_PLUGIN_INLINE_ADD_U64:
|
case PLUGIN_CB_INLINE_ADD_U64:
|
||||||
*val += cb->imm;
|
*val += cb->imm;
|
||||||
break;
|
break;
|
||||||
case QEMU_PLUGIN_INLINE_STORE_U64:
|
case PLUGIN_CB_INLINE_STORE_U64:
|
||||||
*val = cb->imm;
|
*val = cb->imm;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -601,7 +602,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr,
|
|||||||
case PLUGIN_CB_INLINE_ADD_U64:
|
case PLUGIN_CB_INLINE_ADD_U64:
|
||||||
case PLUGIN_CB_INLINE_STORE_U64:
|
case PLUGIN_CB_INLINE_STORE_U64:
|
||||||
if (rw && cb->inline_insn.rw) {
|
if (rw && cb->inline_insn.rw) {
|
||||||
exec_inline_op(&cb->inline_insn, cpu->cpu_index);
|
exec_inline_op(cb->type, &cb->inline_insn, cpu->cpu_index);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -108,7 +108,9 @@ void plugin_register_vcpu_mem_cb(GArray **arr,
|
|||||||
enum qemu_plugin_mem_rw rw,
|
enum qemu_plugin_mem_rw rw,
|
||||||
void *udata);
|
void *udata);
|
||||||
|
|
||||||
void exec_inline_op(struct qemu_plugin_inline_cb *cb, int cpu_index);
|
void exec_inline_op(enum plugin_dyn_cb_type type,
|
||||||
|
struct qemu_plugin_inline_cb *cb,
|
||||||
|
int cpu_index);
|
||||||
|
|
||||||
int plugin_num_vcpus(void);
|
int plugin_num_vcpus(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user