mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-08 07:40:34 +00:00
memory: unify the two branches of cpu_register_physical_memory_log()
Identical except that the second branch knows its not modifying an existing subpage. Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
parent
8636b9295b
commit
717cb7b259
21
exec.c
21
exec.c
@ -2625,7 +2625,6 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
|
|||||||
target_phys_addr_t start_addr = section->offset_within_address_space;
|
target_phys_addr_t start_addr = section->offset_within_address_space;
|
||||||
ram_addr_t size = section->size;
|
ram_addr_t size = section->size;
|
||||||
target_phys_addr_t addr, end_addr;
|
target_phys_addr_t addr, end_addr;
|
||||||
uint16_t *p;
|
|
||||||
CPUState *env;
|
CPUState *env;
|
||||||
ram_addr_t orig_size = size;
|
ram_addr_t orig_size = size;
|
||||||
subpage_t *subpage;
|
subpage_t *subpage;
|
||||||
@ -2638,8 +2637,7 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
|
|||||||
|
|
||||||
addr = start_addr;
|
addr = start_addr;
|
||||||
do {
|
do {
|
||||||
p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 0);
|
uint16_t *p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
|
||||||
if (p && *p != phys_section_unassigned) {
|
|
||||||
uint16_t orig_memory = *p;
|
uint16_t orig_memory = *p;
|
||||||
target_phys_addr_t start_addr2, end_addr2;
|
target_phys_addr_t start_addr2, end_addr2;
|
||||||
int need_subpage = 0;
|
int need_subpage = 0;
|
||||||
@ -2659,23 +2657,6 @@ void cpu_register_physical_memory_log(MemoryRegionSection *section,
|
|||||||
} else {
|
} else {
|
||||||
*p = section_index;
|
*p = section_index;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
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;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addr += TARGET_PAGE_SIZE;
|
addr += TARGET_PAGE_SIZE;
|
||||||
} while (addr != end_addr);
|
} while (addr != end_addr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user