[PATCH v2 1/9] system: Define ram_addr_t to be always uint64_t

Peter Xu <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
QEMU's 32bit host support was deprecated since 10.0 and removed in
11.0 (commit 372ec46b9f), at least system emulation part (cf634dfcd8fc
revived tools).  Now it's safe to move ram_addr_t completely over to
uint64_t.

It should be almost the same as uintptr_t as before for !Xen, except that
on some systems (like MacOS) uintptr_t and uint64_t can be typed slightly
differently, causing unnecessary compiler warnings when use them in a
mixture way.

Hopefully, this change also makes it clear that ram_addr_t is never used as
a host pointer in any form, but only an internal QEMU integer based address
space for allocating ramblocks.

[1] https://lore.kernel.org/r/[email protected]

Cc: Paolo Bonzini <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Suggested-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Signed-off-by: Peter Xu <[email protected]>
---
 include/system/ram_addr.h | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/include/system/ram_addr.h b/include/system/ram_addr.h
index 129f6b8757..044c0b52cc 100644
--- a/include/system/ram_addr.h
+++ b/include/system/ram_addr.h
@@ -14,16 +14,14 @@
 #ifndef RAM_ADDR_H
 #define RAM_ADDR_H
 
-/* address in the RAM (different from a physical address) */
-#if defined(CONFIG_XEN_BACKEND)
+/*
+ * QEMU's internal RAM address space for ramblock allocations (different
+ * from guest physical address).
+ */
 typedef uint64_t ram_addr_t;
-#  define RAM_ADDR_MAX UINT64_MAX
-#  define RAM_ADDR_FMT "%" PRIx64
-#else
-typedef uintptr_t ram_addr_t;
-#  define RAM_ADDR_MAX UINTPTR_MAX
-#  define RAM_ADDR_FMT "%" PRIxPTR
-#endif
+
+#define RAM_ADDR_MAX UINT64_MAX
+#define RAM_ADDR_FMT "%" PRIx64
 
 #define DIRTY_MEMORY_VGA       0
 #define DIRTY_MEMORY_CODE      1
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.