diff --git a/exec-obsolete.h b/exec-obsolete.h
index c099256..8746578 100644
--- a/exec-obsolete.h
+++ b/exec-obsolete.h
@@ -74,6 +74,9 @@ static inline int cpu_physical_memory_get_dirty(ram_addr_t start,
 static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
                                                       int dirty_flags)
 {
+    /* align addr to a page boundary */
+     addr = (addr >> TARGET_PAGE_BITS) << TARGET_PAGE_BITS;
+
     if ((dirty_flags & MIGRATION_DIRTY_FLAG) &&
         !cpu_physical_memory_get_dirty(addr, TARGET_PAGE_SIZE,
                                        MIGRATION_DIRTY_FLAG)) {
