mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 08:45:37 +00:00
translate-all: make less of tb_invalidate_phys_page_range depend on is_cpu_write_access
is_cpu_write_access is only set if tb_invalidate_phys_page_range is called from tb_invalidate_phys_page_fast, and hence from notdirty_mem_write. However: - the code bitmap can be built directly in tb_invalidate_phys_page_fast (unconditionally, since is_cpu_write_access would always be passed as 1); - the virtual address is not needed to mark the page as "not containing code" (dirty code bitmap = 1), so we can also remove that use of is_cpu_write_access. For calls of tb_invalidate_phys_page_range that do not come from notdirty_mem_write, the next call to notdirty_mem_write will notice that the page does not contain code anymore, and will fix up the TLB entry. The parameter needs to remain in order to guard accesses to cpu->mem_io_pc. Backports commit fc377bcf617a48233a99a9fe0a26247c38b5cb76 from qemu
This commit is contained in:
parent
98e2ffba3a
commit
c333585a4d
|
@ -1175,12 +1175,6 @@ void tb_invalidate_phys_page_range(struct uc_struct *uc, tb_page_addr_t start, t
|
|||
if (!p) {
|
||||
return;
|
||||
}
|
||||
if (!p->code_bitmap &&
|
||||
++p->code_write_count >= SMC_BITMAP_USE_THRESHOLD &&
|
||||
is_cpu_write_access) {
|
||||
/* build code bitmap */
|
||||
build_page_bitmap(p);
|
||||
}
|
||||
#if defined(TARGET_HAS_PRECISE_SMC)
|
||||
if (cpu != NULL) {
|
||||
env = cpu->env_ptr;
|
||||
|
@ -1251,9 +1245,7 @@ void tb_invalidate_phys_page_range(struct uc_struct *uc, tb_page_addr_t start, t
|
|||
/* if no code remaining, no need to continue to use slow writes */
|
||||
if (!p->first_tb) {
|
||||
invalidate_page_bitmap(p);
|
||||
if (is_cpu_write_access) {
|
||||
tlb_unprotect_code(cpu, start);
|
||||
}
|
||||
tlb_unprotect_code(cpu, start);
|
||||
}
|
||||
#endif
|
||||
#ifdef TARGET_HAS_PRECISE_SMC
|
||||
|
@ -1410,6 +1402,11 @@ void tb_invalidate_phys_page_fast(struct uc_struct* uc, tb_page_addr_t start, in
|
|||
if (!p) {
|
||||
return;
|
||||
}
|
||||
if (!p->code_bitmap &&
|
||||
++p->code_write_count >= SMC_BITMAP_USE_THRESHOLD) {
|
||||
/* build code bitmap */
|
||||
build_page_bitmap(p);
|
||||
}
|
||||
if (p->code_bitmap) {
|
||||
unsigned int nr;
|
||||
unsigned long b;
|
||||
|
|
Loading…
Reference in a new issue