memory: fix rom_device I/O mode
authorAvi Kivity <avi@redhat.com>
Mon, 29 Aug 2011 06:12:49 +0000 (09:12 +0300)
committerAvi Kivity <avi@redhat.com>
Mon, 29 Aug 2011 08:52:09 +0000 (11:52 +0300)
When adding a rom_device in I/O mode, we incorrectly masked off the low
bits, resulting in a pure RAM map.  Fix my masking off the high bits and
IO_MEM_ROMD, yielding a pure I/O map.

Signed-off-by: Avi Kivity <avi@redhat.com>
memory.c

index 1491a396ec9b5f623b2f556c87764f207c03af3c..eb31fa8e585033e94bb2d488e121184533db1756 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -304,7 +304,7 @@ static void as_memory_range_add(AddressSpace *as, FlatRange *fr)
     }
 
     if (!fr->readable) {
-        phys_offset &= TARGET_PAGE_MASK;
+        phys_offset &= ~TARGET_PAGE_MASK & ~IO_MEM_ROMD;
     }
 
     cpu_register_physical_memory_log(fr->addr.start,