@@ -853,7 +853,6 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr);
/* memory API */
extern int phys_ram_fd;
-extern uint8_t *phys_ram_dirty;
extern ram_addr_t ram_size;
extern ram_addr_t last_ram_offset;
@@ -878,9 +877,16 @@ extern int mem_prealloc;
/* Set if TLB entry is an IO callback. */
#define TLB_MMIO (1 << 5)
+/* Use DIRTY_FLAG as indexes of bit-based phys_ram_dirty.
+ 0x03 is empty to make it compatible with byte-based bitmap. */
+#define MASTER_DIRTY_FLAG 0x00
#define VGA_DIRTY_FLAG 0x01
#define CODE_DIRTY_FLAG 0x02
-#define MIGRATION_DIRTY_FLAG 0x08
+#define MIGRATION_DIRTY_FLAG 0x04
+
+#define NUM_DIRTY_FLAGS 5
+
+extern unsigned long *phys_ram_dirty[NUM_DIRTY_FLAGS];
/* read dirty bit (return 0 or 1) */
static inline int cpu_physical_memory_is_dirty(ram_addr_t addr)