Skip to content

Commit aa47f44

Browse files
pbo-linarostsquad
authored andcommitted
contrib/plugins/cache: fix 32-bit build
Signed-off-by: Pierrick Bouvier <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-Id: <[email protected]> Signed-off-by: Alex Bennée <[email protected]> Message-Id: <[email protected]>
1 parent 03be743 commit aa47f44

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

contrib/plugins/cache.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int fifo_get_first_block(Cache *cache, int set)
208208
static void fifo_update_on_miss(Cache *cache, int set, int blk_idx)
209209
{
210210
GQueue *q = cache->sets[set].fifo_queue;
211-
g_queue_push_head(q, GINT_TO_POINTER(blk_idx));
211+
g_queue_push_head(q, (gpointer)(intptr_t) blk_idx);
212212
}
213213

214214
static void fifo_destroy(Cache *cache)
@@ -471,28 +471,22 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
471471
n_insns = qemu_plugin_tb_n_insns(tb);
472472
for (i = 0; i < n_insns; i++) {
473473
struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i);
474-
uint64_t effective_addr;
475-
476-
if (sys) {
477-
effective_addr = (uint64_t) qemu_plugin_insn_haddr(insn);
478-
} else {
479-
effective_addr = (uint64_t) qemu_plugin_insn_vaddr(insn);
480-
}
474+
uint64_t effective_addr = sys ? (uintptr_t) qemu_plugin_insn_haddr(insn) :
475+
qemu_plugin_insn_vaddr(insn);
481476

482477
/*
483478
* Instructions might get translated multiple times, we do not create
484479
* new entries for those instructions. Instead, we fetch the same
485480
* entry from the hash table and register it for the callback again.
486481
*/
487482
g_mutex_lock(&hashtable_lock);
488-
data = g_hash_table_lookup(miss_ht, GUINT_TO_POINTER(effective_addr));
483+
data = g_hash_table_lookup(miss_ht, &effective_addr);
489484
if (data == NULL) {
490485
data = g_new0(InsnData, 1);
491486
data->disas_str = qemu_plugin_insn_disas(insn);
492487
data->symbol = qemu_plugin_insn_symbol(insn);
493488
data->addr = effective_addr;
494-
g_hash_table_insert(miss_ht, GUINT_TO_POINTER(effective_addr),
495-
(gpointer) data);
489+
g_hash_table_insert(miss_ht, &data->addr, data);
496490
}
497491
g_mutex_unlock(&hashtable_lock);
498492

@@ -853,7 +847,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info,
853847
qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
854848
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
855849

856-
miss_ht = g_hash_table_new_full(NULL, g_direct_equal, NULL, insn_free);
850+
miss_ht = g_hash_table_new_full(g_int64_hash, g_int64_equal, NULL, insn_free);
857851

858852
return 0;
859853
}

0 commit comments

Comments
 (0)