mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
memory: introduce memory_region_test_and_clear_dirty
This function avoids having to do two calls, one to test the dirty bit, and other to reset it. Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
5f718a15d0
commit
6c279db8ee
2 changed files with 32 additions and 0 deletions
16
memory.c
16
memory.c
|
@ -1081,6 +1081,22 @@ void memory_region_set_dirty(MemoryRegion *mr, hwaddr addr,
|
|||
return cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size, -1);
|
||||
}
|
||||
|
||||
bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
|
||||
hwaddr size, unsigned client)
|
||||
{
|
||||
bool ret;
|
||||
assert(mr->terminates);
|
||||
ret = cpu_physical_memory_get_dirty(mr->ram_addr + addr, size,
|
||||
1 << client);
|
||||
if (ret) {
|
||||
cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
|
||||
mr->ram_addr + addr + size,
|
||||
1 << client);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
|
||||
{
|
||||
AddressSpace *as;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue