mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-02-01 23:31:15 +00:00
memory: track DIRTY_MEMORY_CODE in mr->dirty_log_mask
DIRTY_MEMORY_CODE is only needed for TCG. By adding it directly to mr->dirty_log_mask, we avoid testing for TCG everywhere a region is checked for the enabled/disabled state of dirty logging. Backports commit 677e7805cf95f3b2bca8baf0888d1ebed7f0c606 from qemu
This commit is contained in:
parent
e3d1cef8fb
commit
c82ea2b20b
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue