Remove IO_MEM_SUBPAGE

Replace with a MemoryRegion flag.

Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Avi Kivity 2012-01-02 13:20:11 +02:00
parent a621f38de8
commit b3b00c78d8
4 changed files with 7 additions and 6 deletions

View File

@ -116,7 +116,6 @@ extern struct MemoryRegion io_mem_notdirty;
/* Acts like a ROM when read and like a device when written. */ /* Acts like a ROM when read and like a device when written. */
#define IO_MEM_ROMD (1) #define IO_MEM_ROMD (1)
#define IO_MEM_SUBPAGE (2)
#endif #endif

10
exec.c
View File

@ -2552,18 +2552,17 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
ram_addr_t orig_memory = p->phys_offset; ram_addr_t orig_memory = p->phys_offset;
target_phys_addr_t start_addr2, end_addr2; target_phys_addr_t start_addr2, end_addr2;
int need_subpage = 0; 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, CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2,
need_subpage); need_subpage);
if (need_subpage) { if (need_subpage) {
if (!(orig_memory & IO_MEM_SUBPAGE)) { if (!(mr->subpage)) {
subpage = subpage_init((addr & TARGET_PAGE_MASK), subpage = subpage_init((addr & TARGET_PAGE_MASK),
&p->phys_offset, orig_memory, &p->phys_offset, orig_memory,
p->region_offset); p->region_offset);
} else { } else {
MemoryRegion *mr
= io_mem_region[(orig_memory & ~TARGET_PAGE_MASK)
>> IO_MEM_SHIFT];
subpage = container_of(mr, subpage_t, iomem); subpage = container_of(mr, subpage_t, iomem);
} }
subpage_register(subpage, start_addr2, end_addr2, phys_offset, 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; mmio->base = base;
memory_region_init_io(&mmio->iomem, &subpage_ops, mmio, memory_region_init_io(&mmio->iomem, &subpage_ops, mmio,
"subpage", TARGET_PAGE_SIZE); "subpage", TARGET_PAGE_SIZE);
mmio->iomem.subpage = true;
subpage_memory = mmio->iomem.ram_addr; subpage_memory = mmio->iomem.ram_addr;
#if defined(DEBUG_SUBPAGE) #if defined(DEBUG_SUBPAGE)
printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__, printf("%s: %p base " TARGET_FMT_plx " len %08x %d\n", __func__,
mmio, base, TARGET_PAGE_SIZE, subpage_memory); mmio, base, TARGET_PAGE_SIZE, subpage_memory);
#endif #endif
*phys = subpage_memory | IO_MEM_SUBPAGE; *phys = subpage_memory;
subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, orig_memory, region_offset); subpage_register(mmio, 0, TARGET_PAGE_SIZE-1, orig_memory, region_offset);
return mmio; return mmio;

View File

@ -862,6 +862,7 @@ void memory_region_init(MemoryRegion *mr,
} }
mr->addr = 0; mr->addr = 0;
mr->offset = 0; mr->offset = 0;
mr->subpage = false;
mr->enabled = true; mr->enabled = true;
mr->terminates = false; mr->terminates = false;
mr->ram = false; mr->ram = false;

View File

@ -119,6 +119,7 @@ struct MemoryRegion {
void (*destructor)(MemoryRegion *mr); void (*destructor)(MemoryRegion *mr);
ram_addr_t ram_addr; ram_addr_t ram_addr;
IORange iorange; IORange iorange;
bool subpage;
bool terminates; bool terminates;
bool readable; bool readable;
bool ram; bool ram;