accel/tcg: Add CPUState argument to tb_invalidate_phys_page_unwind

Replace existing usage of current_cpu.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2025-04-03 18:06:21 -07:00
parent 43625e35d9
commit 00f708841f
3 changed files with 9 additions and 7 deletions

View file

@ -50,6 +50,7 @@ void tb_invalidate_phys_range_fast(ram_addr_t ram_addr,
uintptr_t retaddr); uintptr_t retaddr);
#endif /* CONFIG_SOFTMMU */ #endif /* CONFIG_SOFTMMU */
bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc); bool tb_invalidate_phys_page_unwind(CPUState *cpu, tb_page_addr_t addr,
uintptr_t pc);
#endif #endif

View file

@ -1045,7 +1045,8 @@ static void tb_invalidate_phys_page(tb_page_addr_t addr)
* TB (because it was modified by this store and the guest CPU has * TB (because it was modified by this store and the guest CPU has
* precise-SMC semantics). * precise-SMC semantics).
*/ */
bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) bool tb_invalidate_phys_page_unwind(CPUState *cpu, tb_page_addr_t addr,
uintptr_t pc)
{ {
TranslationBlock *current_tb; TranslationBlock *current_tb;
bool current_tb_modified; bool current_tb_modified;
@ -1083,15 +1084,14 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc)
* the CPU state. * the CPU state.
*/ */
current_tb_modified = true; current_tb_modified = true;
cpu_restore_state_from_tb(current_cpu, current_tb, pc); cpu_restore_state_from_tb(cpu, current_tb, pc);
} }
tb_phys_invalidate__locked(tb); tb_phys_invalidate__locked(tb);
} }
if (current_tb_modified) { if (current_tb_modified) {
/* Force execution of one insn next time. */ /* Force execution of one insn next time. */
CPUState *cpu = current_cpu; cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu);
cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu);
return true; return true;
} }
return false; return false;

View file

@ -749,7 +749,8 @@ int page_unprotect(CPUState *cpu, tb_page_addr_t address, uintptr_t pc)
len = TARGET_PAGE_SIZE; len = TARGET_PAGE_SIZE;
prot = p->flags | PAGE_WRITE; prot = p->flags | PAGE_WRITE;
pageflags_set_clear(start, start + len - 1, PAGE_WRITE, 0); pageflags_set_clear(start, start + len - 1, PAGE_WRITE, 0);
current_tb_invalidated = tb_invalidate_phys_page_unwind(start, pc); current_tb_invalidated =
tb_invalidate_phys_page_unwind(cpu, start, pc);
} else { } else {
start = address & -host_page_size; start = address & -host_page_size;
len = host_page_size; len = host_page_size;
@ -772,7 +773,7 @@ int page_unprotect(CPUState *cpu, tb_page_addr_t address, uintptr_t pc)
* the corresponding translated code. * the corresponding translated code.
*/ */
current_tb_invalidated |= current_tb_invalidated |=
tb_invalidate_phys_page_unwind(addr, pc); tb_invalidate_phys_page_unwind(cpu, addr, pc);
} }
} }
if (prot & PAGE_EXEC) { if (prot & PAGE_EXEC) {