[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] contrib/plugins/hwprofile: fix warning when compiling on 32b
|
From: |
Pierrick Bouvier |
|
Subject: |
[PATCH 3/6] contrib/plugins/hwprofile: fix warning when compiling on 32bits host |
|
Date: |
Wed, 14 Aug 2024 16:36:42 -0700 |
Found on debian stable (i386).
../contrib/plugins/hwprofile.c: In function 'new_location':
../contrib/plugins/hwprofile.c:172:32: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
172 | g_hash_table_insert(table, (gpointer) off_or_pc, loc);
| ^
../contrib/plugins/hwprofile.c: In function 'vcpu_haddr':
../contrib/plugins/hwprofile.c:227:19: error: cast from pointer to integer of
different size [-Werror=pointer-to-int-cast]
227 | off = (uint64_t) udata;
| ^
../contrib/plugins/hwprofile.c:232:62: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
232 | (gpointer)
off);
| ^
../contrib/plugins/hwprofile.c: In function 'vcpu_tb_trans':
../contrib/plugins/hwprofile.c:250:26: error: cast to pointer from integer of
different size [-Werror=int-to-pointer-cast]
250 | gpointer udata = (gpointer) (source ?
qemu_plugin_insn_vaddr(insn) : 0);
|
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
contrib/plugins/hwprofile.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/contrib/plugins/hwprofile.c b/contrib/plugins/hwprofile.c
index 739ac0c66b5..ee94a74ad94 100644
--- a/contrib/plugins/hwprofile.c
+++ b/contrib/plugins/hwprofile.c
@@ -165,7 +165,7 @@ static DeviceCounts *new_count(const char *name, uint64_t
base)
return count;
}
-static IOLocationCounts *new_location(GHashTable *table, uint64_t off_or_pc)
+static IOLocationCounts *new_location(GHashTable *table, uintptr_t off_or_pc)
{
IOLocationCounts *loc = g_new0(IOLocationCounts, 1);
loc->off_or_pc = off_or_pc;
@@ -201,7 +201,7 @@ static void vcpu_haddr(unsigned int cpu_index,
qemu_plugin_meminfo_t meminfo,
return;
} else {
const char *name = qemu_plugin_hwaddr_device_name(hwaddr);
- uint64_t off = qemu_plugin_hwaddr_phys_addr(hwaddr);
+ uintptr_t off = qemu_plugin_hwaddr_phys_addr(hwaddr);
bool is_write = qemu_plugin_mem_is_store(meminfo);
DeviceCounts *counts;
@@ -224,7 +224,7 @@ static void vcpu_haddr(unsigned int cpu_index,
qemu_plugin_meminfo_t meminfo,
/* either track offsets or source of access */
if (source) {
- off = (uint64_t) udata;
+ off = (uintptr_t) udata;
}
if (pattern || source) {
@@ -247,7 +247,8 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct
qemu_plugin_tb *tb)
for (i = 0; i < n; i++) {
struct qemu_plugin_insn *insn = qemu_plugin_tb_get_insn(tb, i);
- gpointer udata = (gpointer) (source ? qemu_plugin_insn_vaddr(insn) :
0);
+ gpointer udata = (gpointer) (
+ source ? (uintptr_t) qemu_plugin_insn_vaddr(insn) : 0);
qemu_plugin_register_vcpu_mem_cb(insn, vcpu_haddr,
QEMU_PLUGIN_CB_NO_REGS,
rw, udata);
--
2.39.2
[PATCH 2/6] contrib/plugins/cache: fix warning when compiling on 32bits host, Pierrick Bouvier, 2024/08/14