summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-10-17 20:24:28 +0200
committerJuan Quintela <quintela@redhat.com>2012-12-20 23:09:39 +0100
commit6c279db8ee99e64e498447c67c16e987150be96b (patch)
tree3d8080a95dec3133a71adcc871c58eaf41b68d70 /include
parent5f718a15d0db3775bbcf2755a35dd6b019bcff8b (diff)
downloadqemu-6c279db8ee99e64e498447c67c16e987150be96b.tar.gz
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>
Diffstat (limited to 'include')
-rw-r--r--include/exec/memory.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/exec/memory.h b/include/exec/memory.h
index aada969628..2322732dce 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -454,6 +454,22 @@ void memory_region_set_dirty(MemoryRegion *mr, hwaddr addr,
hwaddr size);
/**
+ * memory_region_test_and_clear_dirty: Check whether a range of bytes is dirty
+ * for a specified client. It clears them.
+ *
+ * Checks whether a range of bytes has been written to since the last
+ * call to memory_region_reset_dirty() with the same @client. Dirty logging
+ * must be enabled.
+ *
+ * @mr: the memory region being queried.
+ * @addr: the address (relative to the start of the region) being queried.
+ * @size: the size of the range being queried.
+ * @client: the user of the logging information; %DIRTY_MEMORY_MIGRATION or
+ * %DIRTY_MEMORY_VGA.
+ */
+bool memory_region_test_and_clear_dirty(MemoryRegion *mr, hwaddr addr,
+ hwaddr size, unsigned client);
+/**
* memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
* any external TLBs (e.g. kvm)
*