提交 8636b929 编写于 作者: A Avi Kivity

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 db7b5426, which introduced subpages.
Signed-off-by: NAvi Kivity <avi@redhat.com>
上级 d6f2ea22
...@@ -2660,22 +2660,20 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section, ...@@ -2660,22 +2660,20 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
*p = section_index; *p = section_index;
} }
} else { } 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 = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
*p = section_index; *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, CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr,
end_addr2, need_subpage); end_addr2, need_subpage);
if (need_subpage) { if (need_subpage) {
subpage = subpage_init((addr & TARGET_PAGE_MASK), subpage = subpage_init((addr & TARGET_PAGE_MASK),
p, phys_section_unassigned); p, phys_section_unassigned);
subpage_register(subpage, start_addr2, end_addr2, subpage_register(subpage, start_addr2, end_addr2,
section_index); section_index);
}
} }
} }
addr += TARGET_PAGE_SIZE; addr += TARGET_PAGE_SIZE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册