[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 27/39] plugins: fix-up handling of internal hostaddr for 32 bi
From: |
Alex Bennée |
Subject: |
[PATCH v1 27/39] plugins: fix-up handling of internal hostaddr for 32 bit |
Date: |
Tue, 6 Jul 2021 15:58:05 +0100 |
The compiler rightly complains when we build on 32 bit that casting
uint64_t into a void is a bad idea. We are really dealing with a host
pointer at this point so treat it as such. This does involve
a uintptr_t cast of the result of the TLB addend as we know that has
to point to the host memory.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
include/qemu/plugin-memory.h | 2 +-
accel/tcg/cputlb.c | 2 +-
plugins/api.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/qemu/plugin-memory.h b/include/qemu/plugin-memory.h
index b36def27d7..0f59226727 100644
--- a/include/qemu/plugin-memory.h
+++ b/include/qemu/plugin-memory.h
@@ -18,7 +18,7 @@ struct qemu_plugin_hwaddr {
hwaddr offset;
} io;
struct {
- uint64_t hostaddr;
+ void *hostaddr;
} ram;
} v;
};
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index b6d5fc6326..b4e15b6aad 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -1728,7 +1728,7 @@ bool tlb_plugin_lookup(CPUState *cpu, target_ulong addr,
int mmu_idx,
data->v.io.offset = (iotlbentry->addr & TARGET_PAGE_MASK) + addr;
} else {
data->is_io = false;
- data->v.ram.hostaddr = addr + tlbe->addend;
+ data->v.ram.hostaddr = (void *)((uintptr_t)addr + tlbe->addend);
}
return true;
} else {
diff --git a/plugins/api.c b/plugins/api.c
index 332e2c60e2..78b563c5c5 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -308,11 +308,11 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct
qemu_plugin_hwaddr *haddr)
if (!haddr->is_io) {
RAMBlock *block;
ram_addr_t offset;
- void *hostaddr = (void *) haddr->v.ram.hostaddr;
+ void *hostaddr = haddr->v.ram.hostaddr;
block = qemu_ram_block_from_host(hostaddr, false, &offset);
if (!block) {
- error_report("Bad ram pointer %"PRIx64"",
haddr->v.ram.hostaddr);
+ error_report("Bad host ram pointer %p", haddr->v.ram.hostaddr);
abort();
}
--
2.20.1
- [PATCH v1 20/39] tests/docker: expand fedora package list, (continued)
- [PATCH v1 20/39] tests/docker: expand fedora package list, Alex Bennée, 2021/07/06
- [PATCH v1 30/39] configure: stop user enabling plugins on Windows for now, Alex Bennée, 2021/07/06
- [PATCH v1 22/39] tests/docker: expand ubuntu2004 package list, Alex Bennée, 2021/07/06
- [PATCH v1 36/39] plugins/cache: Enable cache parameterization, Alex Bennée, 2021/07/06
- [PATCH v1 16/39] tests/docker: fix mistakes in fedora package list, Alex Bennée, 2021/07/06
- [PATCH v1 19/39] tests/docker: expand centos8 package list, Alex Bennée, 2021/07/06
- [PATCH v1 39/39] MAINTAINTERS: Added myself as a reviewer for TCG Plugins, Alex Bennée, 2021/07/06
- [PATCH v1 14/39] tests/docker: fix sorting in package lists, Alex Bennée, 2021/07/06
- [PATCH v1 27/39] plugins: fix-up handling of internal hostaddr for 32 bit,
Alex Bennée <=
- [PATCH v1 17/39] tests/docker: fix mistakes in ubuntu package lists, Alex Bennée, 2021/07/06
- [PATCH v1 31/39] tcg/plugins: enable by default for TCG builds, Alex Bennée, 2021/07/06
- [PATCH v1 25/39] tests/vm: update openbsd to release 6.9, Alex Bennée, 2021/07/06
- [PATCH v1 38/39] docs/devel: Added cache plugin to the plugins docs, Alex Bennée, 2021/07/06
- [PATCH v1 24/39] tests/vm: update NetBSD to 9.2, Alex Bennée, 2021/07/06
- [PATCH v1 18/39] tests/docker: remove mingw packages from Fedora, Alex Bennée, 2021/07/06
- [PATCH v1 35/39] plugins: Added a new cache modelling plugin, Alex Bennée, 2021/07/06