]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Remove IO_MEM_SUBPAGE
authorAvi Kivity <avi@redhat.com>
Mon, 2 Jan 2012 11:20:11 +0000 (13:20 +0200)
committerAvi Kivity <avi@redhat.com>
Wed, 4 Jan 2012 11:34:50 +0000 (13:34 +0200)
Replace with a MemoryRegion flag.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
cpu-common.h
exec.c
memory.c
memory.h

index 98dddfeae89c49424b1e3b9370bea72f3178a093..ffb0a44e13a70ac5df4e62e73f4dcb8769428eed 100644 (file)
@@ -116,7 +116,6 @@ extern struct MemoryRegion io_mem_notdirty;
 
 /* Acts like a ROM when read and like a device when written.  */
 #define IO_MEM_ROMD        (1)
-#define IO_MEM_SUBPAGE     (2)
 
 #endif
 
diff --git a/exec.c b/exec.c
index a61a89ff443a930d0f1335d716d9ad4c440e46c3..d5b82aabba5ad28017a38bad9d91d6bc3ca4a7c1 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -2552,18 +2552,17 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
             ram_addr_t orig_memory = p->phys_offset;
             target_phys_addr_t start_addr2, end_addr2;
             int need_subpage = 0;
+            MemoryRegion *mr = io_mem_region[(orig_memory & ~TARGET_PAGE_MASK)
+                                             >> IO_MEM_SHIFT];
 
             CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2,
                           need_subpage);
             if (need_subpage) {
-                if (!(orig_memory & IO_MEM_SUBPAGE)) {
+                if (!(mr->subpage)) {
                     subpage = subpage_init((addr & TARGET_PAGE_MASK),
                                            &p->phys_offset, orig_memory,
                                            p->region_offset);
                 } else {
-                    MemoryRegion *mr
-                        = io_mem_region[(orig_memory & ~TARGET_PAGE_MASK)
-                                        >> IO_MEM_SHIFT];
                     subpage = container_of(mr, subpage_t, iomem);
                 }
                 subpage_register(subpage, start_addr2, end_addr2, phys_offset,
@@ -3396,12 +3395,13 @@ static subpage_t *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
     mmio->base = base;
     memory_region_init_io(&mmio->iomem, &subpage_ops, mmio,
                           "subpage", TARGET_PAGE_SIZE);
+    mmio->iomem.subpage = true;
     subpage_memory = mmio->iomem.ram_addr;
 #if defined(DEBUG_SUBPAGE)
     printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__,
            mmio, base, TARGET_PAGE_SIZE, subpage_memory);
 #endif
-    *phys = subpage_memory | IO_MEM_SUBPAGE;
+    *phys = subpage_memory;
     subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, orig_memory, region_offset);
 
     return mmio;
index 25b36ff9d6d9632f06cfdbcf962e977dbc96bcc5..24b6b6f8f33bcb6d02c18d2c62d305b9fc7547cd 100644 (file)
--- a/memory.c
+++ b/memory.c
@@ -862,6 +862,7 @@ void memory_region_init(MemoryRegion *mr,
     }
     mr->addr = 0;
     mr->offset = 0;
+    mr->subpage = false;
     mr->enabled = true;
     mr->terminates = false;
     mr->ram = false;
index 77984bb4e4adcfc7e3d3f03766163ff7088eae29..fbca6f146c17b2c4207679c5fda8f47ad2f65b29 100644 (file)
--- a/memory.h
+++ b/memory.h
@@ -119,6 +119,7 @@ struct MemoryRegion {
     void (*destructor)(MemoryRegion *mr);
     ram_addr_t ram_addr;
     IORange iorange;
+    bool subpage;
     bool terminates;
     bool readable;
     bool ram;