diff --git a/qemu/include/exec/memory.h b/qemu/include/exec/memory.h index 46dcd2ee..f7c32f16 100644 --- a/qemu/include/exec/memory.h +++ b/qemu/include/exec/memory.h @@ -522,8 +522,8 @@ bool memory_region_is_logging(MemoryRegion *mr, uint8_t client); * memory_region_get_dirty_log_mask: return the clients for which a * memory region is logging writes. * - * Returns a bitmap of clients, which right now will be either 0 or - * (1 << DIRTY_MEMORY_VGA). + * Returns a bitmap of clients, in which the DIRTY_MEMORY_* constants + * are the bit indices. * * @mr: the memory region being queried */ diff --git a/qemu/memory.c b/qemu/memory.c index 97275816..75917302 100644 --- a/qemu/memory.c +++ b/qemu/memory.c @@ -1162,6 +1162,7 @@ void memory_region_init_ram(struct uc_struct *uc, MemoryRegion *mr, mr->terminates = true; mr->destructor = memory_region_destructor_ram; mr->ram_addr = qemu_ram_alloc(size, mr, errp); + mr->dirty_log_mask = tcg_enabled(uc) ? (1 << DIRTY_MEMORY_CODE) : 0; } void memory_region_init_ram_ptr(struct uc_struct *uc, MemoryRegion *mr, @@ -1174,6 +1175,7 @@ void memory_region_init_ram_ptr(struct uc_struct *uc, MemoryRegion *mr, mr->ram = true; mr->terminates = true; mr->destructor = memory_region_destructor_ram_from_ptr; + mr->dirty_log_mask = tcg_enabled(uc) ? (1 << DIRTY_MEMORY_CODE) : 0; /* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */ assert(ptr != NULL);