memory: Fix memory_region_get_ram_ptr for ROM devices
authorJan Kiszka <jan.kiszka@siemens.com>
Mon, 29 Aug 2011 22:38:24 +0000 (00:38 +0200)
committerAvi Kivity <avi@redhat.com>
Tue, 30 Aug 2011 08:20:18 +0000 (11:20 +0300)
Mask out the sub-page bits that are used by ROM device for storing the
io-index and the IO_MEM_ROMD flag.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
memory.c

index eb31fa8e585033e94bb2d488e121184533db1756..57f0fa44ff5b501ee9cb1a740fc5acd311f169dc 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -1063,7 +1063,7 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr)
 
     assert(mr->terminates);
 
-    return qemu_get_ram_ptr(mr->ram_addr);
+    return qemu_get_ram_ptr(mr->ram_addr & TARGET_PAGE_MASK);
 }
 
 static void memory_region_update_coalesced_range(MemoryRegion *mr)