aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-02-12 21:10:50 +0200
committerAvi Kivity <avi@redhat.com>2012-02-29 13:44:43 +0200
commit8636b9295be46307a1de86942accabea50fa59ae (patch)
tree77593ff6a335f0805eb53e271e06ff50543ecd0d /exec.c
parentd6f2ea22a05b429ba83248b80a625b6fe1d927f3 (diff)
memory: fix RAM subpages in newly initialized pages
If the first subpage installed in a page is RAM, then we install it as a full page, instead of a subpage. Fix by not special casing RAM. The issue dates to commit db7b5426a4b4242, which introduced subpages. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/exec.c b/exec.c
index 0756919e66..5d0afdbdeb 100644
--- a/exec.c
+++ b/exec.c
@@ -2660,22 +2660,20 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
*p = section_index;
}
} else {
- MemoryRegion *mr = section->mr;
+ target_phys_addr_t start_addr2, end_addr2;
+ int need_subpage = 0;
+
p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
*p = section_index;
- if (!(memory_region_is_ram(mr) || mr->rom_device)) {
- target_phys_addr_t start_addr2, end_addr2;
- int need_subpage = 0;
- CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr,
- end_addr2, need_subpage);
+ CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr,
+ end_addr2, need_subpage);
- if (need_subpage) {
- subpage = subpage_init((addr & TARGET_PAGE_MASK),
- p, phys_section_unassigned);
- subpage_register(subpage, start_addr2, end_addr2,
- section_index);
- }
+ if (need_subpage) {
+ subpage = subpage_init((addr & TARGET_PAGE_MASK),
+ p, phys_section_unassigned);
+ subpage_register(subpage, start_addr2, end_addr2,
+ section_index);
}
}
addr += TARGET_PAGE_SIZE;