[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/6] exec: Restrict 32-bit CPUs to 32-bit address space
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 5/6] exec: Restrict 32-bit CPUs to 32-bit address space |
Date: |
Sun, 31 May 2020 19:54:24 +0200 |
It is pointless to have 32-bit CPUs see a 64-bit address
space, when they can only address the 32 lower bits.
Only create CPU address space with a size it can address.
This makes HMP 'info mtree' command easier to understand
(on 32-bit CPUs).
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
This is particularly helpful with the AVR cores.
---
exec.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/exec.c b/exec.c
index 5162f0d12f..d6809a9447 100644
--- a/exec.c
+++ b/exec.c
@@ -2962,9 +2962,17 @@ static void tcg_commit(MemoryListener *listener)
static void memory_map_init(void)
{
+ uint64_t system_memory_size;
+
+#if TARGET_LONG_BITS >= 64
+ system_memory_size = UINT64_MAX;
+#else
+ system_memory_size = 1ULL << TARGET_LONG_BITS;
+#endif
+
system_memory = g_malloc(sizeof(*system_memory));
- memory_region_init(system_memory, NULL, "system", UINT64_MAX);
+ memory_region_init(system_memory, NULL, "system", system_memory_size);
address_space_init(&address_space_memory, system_memory, "memory");
system_io = g_malloc(sizeof(*system_io));
--
2.21.3
- [PATCH 0/6] exec/memory: Rework some address and access size limits, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 1/6] target/s390x/mmu_helper: Use address_space_rw() in place, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 3/6] hw/sd/allwinner-sdhost: Do DMA accesses via DMA address space, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 2/6] hw/dma/rc4030: Use DMA address space to do DMA accesses, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 4/6] exec/cpu-common: Do not restrict CPU to 32-bit memory access maximum, Philippe Mathieu-Daudé, 2020/05/31
- [PATCH 5/6] exec: Restrict 32-bit CPUs to 32-bit address space,
Philippe Mathieu-Daudé <=
- [RFC PATCH 6/6] memory: Use CPU register size as default access_size_max, Philippe Mathieu-Daudé, 2020/05/31
- Re: [PATCH 0/6] exec/memory: Rework some address and access size limits, no-reply, 2020/05/31