memory: do not touch code dirty bitmap unless TCG is enabled

cpu_physical_memory_set_dirty_lebitmap unconditionally syncs the
DIRTY_MEMORY_CODE bitmap. This however is unused unless TCG is
enabled.

Backports commit 9460dee4b2258e3990906fb34099481c8334c267 from qemu
This commit is contained in:
Paolo Bonzini 2018-02-13 10:46:27 -05:00 committed by Lioncash
parent 6172e3dc29
commit 6bbfcf65e8
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7

View File

@ -125,10 +125,13 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(struct uc_struct *uc,
for (k = 0; k < nr; k++) {
if (bitmap[k]) {
unsigned long temp = leul_to_cpu(bitmap[k]);
uc->ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp;
if (tcg_enabled(uc)) {
uc->ram_list.dirty_memory[DIRTY_MEMORY_CODE][page + k] |= temp;
}
}
}
} else {
uint8_t clients = tcg_enabled(uc) ? DIRTY_CLIENTS_ALL : DIRTY_CLIENTS_NOCODE;
/*
* bitmap-traveling is faster than memory-traveling (for addr...)
* especially when most of the memory is not dirty.
@ -143,8 +146,7 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(struct uc_struct *uc,
addr = page_number * TARGET_PAGE_SIZE;
ram_addr = start + addr;
cpu_physical_memory_set_dirty_range(uc, ram_addr,
TARGET_PAGE_SIZE * hpratio,
DIRTY_CLIENTS_ALL);
TARGET_PAGE_SIZE * hpratio, clients);
} while (c != 0);
}
}