To be sure an AddressSpace is zero-based, forbid changing
base address of MemoryRegion used as AddressSpace container.

Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
---
Based-on: <20210417103028.601124-1-f4...@amsat.org>
---
 softmmu/memory.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/softmmu/memory.c b/softmmu/memory.c
index 409bcaec7f5..73c0e6f84f5 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -2522,6 +2522,7 @@ static void memory_region_readd_subregion(MemoryRegion 
*mr)
 
 void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
 {
+    assert(!mr->is_root_mr);
     if (addr != mr->addr) {
         mr->addr = addr;
         memory_region_readd_subregion(mr);
-- 
2.26.3


Reply via email to