memory: Sync before doing a test and clear

This commit is contained in:
Matt Borgerson 2020-02-18 04:01:19 -07:00
parent 3e5da78157
commit 4a6910f052

View File

@ -2049,19 +2049,6 @@ void memory_region_set_client_dirty(MemoryRegion *mr, hwaddr addr,
size, 1 << client); size, 1 << client);
} }
bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
hwaddr size, unsigned client)
{
if (mr->alias) {
return memory_region_test_and_clear_dirty(mr->alias,
addr - mr->alias_offset,
size, client);
}
assert(mr->terminates);
return cpu_physical_memory_test_and_clear_dirty(
memory_region_get_ram_addr(mr) + addr, size, client);
}
static void memory_region_sync_dirty_bitmap(MemoryRegion *mr) static void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
{ {
MemoryListener *listener; MemoryListener *listener;
@ -2090,6 +2077,20 @@ static void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
} }
} }
bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
hwaddr size, unsigned client)
{
if (mr->alias) {
return memory_region_test_and_clear_dirty(mr->alias,
addr - mr->alias_offset,
size, client);
}
assert(mr->terminates);
memory_region_sync_dirty_bitmap(mr);
return cpu_physical_memory_test_and_clear_dirty(
memory_region_get_ram_addr(mr) + addr, size, client);
}
void memory_region_clear_dirty_bitmap(MemoryRegion *mr, hwaddr start, void memory_region_clear_dirty_bitmap(MemoryRegion *mr, hwaddr start,
hwaddr len) hwaddr len)
{ {