Signed-off-by: Juan Quintela <quint...@redhat.com>
---
 memory.c | 4 +++-
 memory.h | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/memory.c b/memory.c
index 126fb63..4d0fa96 100644
--- a/memory.c
+++ b/memory.c
@@ -1089,7 +1089,9 @@ bool memory_region_test_and_clear_dirty(MemoryRegion *mr,
     ret = cpu_physical_memory_get_dirty(mr->ram_addr + addr, size,
                                         1 << client);
     if (ret) {
-        cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size, -1);
+        cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
+                                        mr->ram_addr + addr + size,
+                                        1 << client);
     }
     return ret;
 }
diff --git a/memory.h b/memory.h
index 08af012..0dcc0f4 100644
--- a/memory.h
+++ b/memory.h
@@ -449,7 +449,8 @@ void memory_region_set_dirty(MemoryRegion *mr, 
target_phys_addr_t addr,
  */
 bool memory_region_test_and_clear_dirty(MemoryRegion *mr,
                                         target_phys_addr_t addr,
-                                        target_phys_addr_t size, unsigned 
client)
+                                        target_phys_addr_t size,
+                                        unsigned client);
 /**
  * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
  *                                  any external TLBs (e.g. kvm)
-- 
1.7.11.7


Reply via email to