@@ -439,11 +439,8 @@ static TCGOp *append_inline_cb(const struct qemu_plugin_dyn_cb *cb,
TCGOp *begin_op, TCGOp *op,
int *unused)
{
- char *ptr = cb->userp;
- if (!cb->inline_direct_ptr) {
- /* dereference userp once to get access to memory location */
- ptr = *(char **)cb->userp;
- }
+ /* always dereference userp for inline operations */
+ char *ptr = *(char **)cb->userp;
op = copy_ld_i32(&begin_op, op);
op = copy_mul_i32(&begin_op, op, cb->inline_element_size);
op = copy_ext_i32_ptr(&begin_op, op);
@@ -88,7 +88,6 @@ struct qemu_plugin_dyn_cb {
void *userp;
size_t inline_offset;
size_t inline_element_size;
- bool inline_direct_ptr;
enum plugin_dyn_cb_subtype type;
/* @rw applies to mem callbacks only (both regular and inline) */
enum qemu_plugin_mem_rw rw;
@@ -109,9 +109,7 @@ void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu(
{
if (!tb->mem_only) {
plugin_register_inline_op(&tb->cbs[PLUGIN_CB_INLINE],
- 0, op, entry.score->data,
- entry.offset, entry.score->element_size,
- false, imm);
+ 0, op, entry, imm);
}
}
@@ -138,9 +136,7 @@ void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(
{
if (!insn->mem_only) {
plugin_register_inline_op(&insn->cbs[PLUGIN_CB_INSN][PLUGIN_CB_INLINE],
- 0, op, entry.score->data,
- entry.offset, entry.score->element_size,
- false, imm);
+ 0, op, entry, imm);
}
}
@@ -167,9 +163,7 @@ void qemu_plugin_register_vcpu_mem_inline_per_vcpu(
uint64_t imm)
{
plugin_register_inline_op(&insn->cbs[PLUGIN_CB_MEM][PLUGIN_CB_INLINE],
- rw, op, entry.score->data,
- entry.offset, entry.score->element_size,
- false, imm);
+ rw, op, entry, imm);
}
void qemu_plugin_register_vcpu_tb_trans_cb(qemu_plugin_id_t id,
@@ -347,17 +347,15 @@ static struct qemu_plugin_dyn_cb *plugin_get_dyn_cb(GArray **arr)
void plugin_register_inline_op(GArray **arr,
enum qemu_plugin_mem_rw rw,
enum qemu_plugin_op op,
- void *ptr, size_t offset, size_t element_size,
- bool direct_ptr,
+ qemu_plugin_u64_t entry,
uint64_t imm)
{
struct qemu_plugin_dyn_cb *dyn_cb;
dyn_cb = plugin_get_dyn_cb(arr);
- dyn_cb->userp = ptr;
- dyn_cb->inline_element_size = element_size;
- dyn_cb->inline_offset = offset;
- dyn_cb->inline_direct_ptr = direct_ptr;
+ dyn_cb->userp = entry.score->data;
+ dyn_cb->inline_element_size = entry.score->element_size;
+ dyn_cb->inline_offset = entry.offset;
dyn_cb->type = PLUGIN_CB_INLINE;
dyn_cb->rw = rw;
dyn_cb->inline_insn.op = op;
@@ -504,11 +502,8 @@ void qemu_plugin_flush_cb(void)
void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int cpu_index)
{
- char *ptr = cb->userp;
- if (!cb->inline_direct_ptr) {
- ptr = *(char **) cb->userp;
- }
- ptr += cb->inline_offset;
+ /* always dereference userp for inline operations */
+ char *ptr = (*(char **) cb->userp) + cb->inline_offset;
uint64_t *val = (uint64_t *)(ptr + cpu_index * cb->inline_element_size);
switch (cb->inline_insn.op) {
@@ -71,8 +71,7 @@ struct qemu_plugin_ctx *plugin_id_to_ctx_locked(qemu_plugin_id_t id);
void plugin_register_inline_op(GArray **arr,
enum qemu_plugin_mem_rw rw,
enum qemu_plugin_op op,
- void *ptr, size_t offset, size_t element_size,
- bool direct_ptr,
+ qemu_plugin_u64_t entry,
uint64_t imm);
void plugin_reset_uninstall(qemu_plugin_id_t id,
Now inline previous API was removed, we can cleanup code path associated. Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> --- accel/tcg/plugin-gen.c | 7 ++----- include/qemu/plugin.h | 1 - plugins/api.c | 12 +++--------- plugins/core.c | 17 ++++++----------- plugins/plugin.h | 3 +-- 5 files changed, 12 insertions(+), 28 deletions(-)