Revision e44d26c8 arch_init.c

b/arch_init.c
331 331
static RAMBlock *last_block;
332 332
static ram_addr_t last_offset;
333 333

  
334
static inline void migration_bitmap_set_dirty(MemoryRegion *mr, int length)
335
{
336
    ram_addr_t addr;
337

  
338
    for (addr = 0; addr < length; addr += TARGET_PAGE_SIZE) {
339
        if (!memory_region_get_dirty(mr, addr, TARGET_PAGE_SIZE,
340
                                     DIRTY_MEMORY_MIGRATION)) {
341
            memory_region_set_dirty(mr, addr, TARGET_PAGE_SIZE);
342
        }
343
    }
344
}
345

  
334 346
/*
335 347
 * ram_save_block: Writes a page of memory to the stream f
336 348
 *
......
493 505

  
494 506
static int ram_save_setup(QEMUFile *f, void *opaque)
495 507
{
496
    ram_addr_t addr;
497 508
    RAMBlock *block;
498 509

  
499 510
    bytes_transferred = 0;
......
514 525

  
515 526
    /* Make sure all dirty bits are set */
516 527
    QLIST_FOREACH(block, &ram_list.blocks, next) {
517
        for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) {
518
            if (!memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE,
519
                                         DIRTY_MEMORY_MIGRATION)) {
520
                memory_region_set_dirty(block->mr, addr, TARGET_PAGE_SIZE);
521
            }
522
        }
528
        migration_bitmap_set_dirty(block->mr, block->length);
523 529
    }
524 530

  
525 531
    memory_global_dirty_log_start();

Also available in: Unified diff