[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 16/22] contrib/plugins/cache: fix 32-bit build
From: |
Alex Bennée |
Subject: |
[PATCH 16/22] contrib/plugins/cache: fix 32-bit build |
Date: |
Thu, 9 Jan 2025 17:06:13 +0000 |
From: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20241217224306.2900490-7-pierrick.bouvier@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
contrib/plugins/cache.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c
index 512ef6776b..7baff86860 100644
--- a/contrib/plugins/cache.c
+++ b/contrib/plugins/cache.c
@@ -208,7 +208,7 @@ static int fifo_get_first_block(Cache *cache, int set)
static void fifo_update_on_miss(Cache *cache, int set, int blk_idx)
{
GQueue *q = cache->sets[set].fifo_queue;
- g_queue_push_head(q, GINT_TO_POINTER(blk_idx));
+ g_queue_push_head(q, (gpointer)(intptr_t) blk_idx);
}
static void fifo_destroy(Cache *cache)
@@ -471,13 +471,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
n_insns = qemu_plugin_tb_n_insns(tb);
for (i = 0; i < n_insns; i++) {
struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i);
- uint64_t effective_addr;
-
- if (sys) {
- effective_addr = (uint64_t) qemu_plugin_insn_haddr(insn);
- } else {
- effective_addr = (uint64_t) qemu_plugin_insn_vaddr(insn);
- }
+ uint64_t effective_addr = sys ? (uintptr_t)
qemu_plugin_insn_haddr(insn) :
+ qemu_plugin_insn_vaddr(insn);
/*
* Instructions might get translated multiple times, we do not create
@@ -485,14 +480,13 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
* entry from the hash table and register it for the callback again.
*/
g_mutex_lock(&hashtable_lock);
- data = g_hash_table_lookup(miss_ht, GUINT_TO_POINTER(effective_addr));
+ data = g_hash_table_lookup(miss_ht, &effective_addr);
if (data == NULL) {
data = g_new0(InsnData, 1);
data->disas_str = qemu_plugin_insn_disas(insn);
data->symbol = qemu_plugin_insn_symbol(insn);
data->addr = effective_addr;
- g_hash_table_insert(miss_ht, GUINT_TO_POINTER(effective_addr),
- (gpointer) data);
+ g_hash_table_insert(miss_ht, &data->addr, data);
}
g_mutex_unlock(&hashtable_lock);
@@ -853,7 +847,7 @@ int qemu_plugin_install(qemu_plugin_id_t id, const
qemu_info_t *info,
qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
- miss_ht = g_hash_table_new_full(NULL, g_direct_equal, NULL, insn_free);
+ miss_ht = g_hash_table_new_full(g_int64_hash, g_int64_equal, NULL,
insn_free);
return 0;
}
--
2.39.5
- [PATCH 00/22] maintainer updates for jan '25 (semihosting, gdb, plugins), Alex Bennée, 2025/01/09
- [PATCH 05/22] semihosting/arm-compat: Include missing 'cpu.h' header, Alex Bennée, 2025/01/09
- [PATCH 04/22] semihosting/uaccess: Include missing 'exec/cpu-all.h' header, Alex Bennée, 2025/01/09
- [PATCH 02/22] semihosting/uaccess: Briefly document returned values, Alex Bennée, 2025/01/09
- [PATCH 01/22] semihosting: add guest_error logging for failed opens, Alex Bennée, 2025/01/09
- [PATCH 09/22] system: squash usb_parse into a single function, Alex Bennée, 2025/01/09
- [PATCH 13/22] tests/tcg/plugins/syscall: fix 32-bit build, Alex Bennée, 2025/01/09
- [PATCH 14/22] tests/tcg/plugins/mem: fix 32-bit build, Alex Bennée, 2025/01/09
- [PATCH 16/22] contrib/plugins/cache: fix 32-bit build,
Alex Bennée <=
- [PATCH 07/22] semihosting/meson: Build config.o and console.o once, Alex Bennée, 2025/01/09
- [PATCH 12/22] contrib/plugins/howvec: ensure we don't regress if this plugin is extended, Alex Bennée, 2025/01/09
- [PATCH 08/22] system/vl: more error exit into config enumeration code, Alex Bennée, 2025/01/09
- [PATCH 06/22] semihosting/console: Avoid including 'cpu.h', Alex Bennée, 2025/01/09
- [PATCH 03/22] semihosting/syscalls: Include missing 'exec/cpu-defs.h' header, Alex Bennée, 2025/01/09
- [PATCH 10/22] system: propagate Error to gdbserver_start (and other device setups), Alex Bennée, 2025/01/09