Skip to content

Commit aa296ad

Browse files
committed
address_space_dispatch_clear remove subpage with higher priority
1 parent 0cb155c commit aa296ad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

qemu/exec.c

+10
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,7 @@ static subpage_t *subpage_init(struct uc_struct *uc, FlatView *fv, hwaddr base)
13951395
memory_region_init_io(fv->root->uc, &mmio->iomem, &subpage_ops, mmio,
13961396
TARGET_PAGE_SIZE);
13971397
mmio->iomem.subpage = true;
1398+
mmio->iomem.priority = uc->snapshot_level;
13981399
#if defined(DEBUG_SUBPAGE)
13991400
printf("%s: %p base " TARGET_FMT_plx " len %08x\n", __func__,
14001401
mmio, base, TARGET_PAGE_SIZE);
@@ -1457,6 +1458,15 @@ AddressSpaceDispatch *address_space_dispatch_new(struct uc_struct *uc, FlatView
14571458

14581459
void address_space_dispatch_clear(AddressSpaceDispatch *d)
14591460
{
1461+
MemoryRegionSection *section;
1462+
struct uc_struct *uc = d->uc;
1463+
while (d->map.sections_nb > 0) {
1464+
d->map.sections_nb--;
1465+
section = &d->map.sections[d->map.sections_nb];
1466+
if (section->mr->priority > uc->snapshot_level) {
1467+
phys_section_destroy(section->mr);
1468+
}
1469+
}
14601470
g_free(d->map.sections);
14611471
g_free(d->map.nodes);
14621472
g_free(d);

0 commit comments

Comments
 (0)