[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/40] plugins: fix-up handling of internal hostaddr for 32 bit
From: |
Alex Bennée |
Subject: |
[PULL 27/40] plugins: fix-up handling of internal hostaddr for 32 bit |
Date: |
Mon, 12 Jul 2021 13:26:40 +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>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210709143005.1554-28-alex.bennee@linaro.org>
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
- [PULL 06/40] build: validate that system capstone works before using it, (continued)
- [PULL 06/40] build: validate that system capstone works before using it, Alex Bennée, 2021/07/12
- [PULL 04/40] Jobs based on custom runners: add job definitions for QEMU's machines, Alex Bennée, 2021/07/12
- [PULL 09/40] hw/usb/ccid: remove references to NSS, Alex Bennée, 2021/07/12
- [PULL 05/40] tests/tcg: also disable the signals test for plugins, Alex Bennée, 2021/07/12
- [PULL 31/40] configure: stop user enabling plugins on Windows for now, Alex Bennée, 2021/07/12
- [PULL 07/40] gitlab: support for FreeBSD 12, 13 and macOS 11 via cirrus-run, Alex Bennée, 2021/07/12
- [PULL 08/40] cirrus: delete FreeBSD and macOS jobs, Alex Bennée, 2021/07/12
- [PULL 10/40] tests/docker: don't use BUILDKIT in GitLab either, Alex Bennée, 2021/07/12
- [PULL 36/40] plugins: Added a new cache modelling plugin, Alex Bennée, 2021/07/12
- [PULL 29/40] configure: don't allow plugins to be enabled for a non-TCG build, Alex Bennée, 2021/07/12
- [PULL 27/40] plugins: fix-up handling of internal hostaddr for 32 bit,
Alex Bennée <=
- [PULL 33/40] contrib/plugins: enable -Wall for building plugins, Alex Bennée, 2021/07/12
- [PULL 35/40] docs/devel: tcg-plugins: add execlog plugin description, Alex Bennée, 2021/07/12
- [PULL 11/40] tests/docker: use project specific container registries, Alex Bennée, 2021/07/12
- [PULL 13/40] tests/docker: remove FEATURES env var from templates, Alex Bennée, 2021/07/12
- [PULL 24/40] tests/vm: update NetBSD to 9.2, Alex Bennée, 2021/07/12
- [PULL 23/40] tests/docker: expand opensuse-leap package list, Alex Bennée, 2021/07/12
- [PULL 26/40] tests/tcg: make test-mmap a little less aggressive, Alex Bennée, 2021/07/12
- [PULL 32/40] tcg/plugins: enable by default for most TCG builds, Alex Bennée, 2021/07/12