@@ -80,7 +80,7 @@ void tlb_flush(CPUState *cpu, int flush_global)
memset(env->tlb_table, -1, sizeof(env->tlb_table));
memset(env->tlb_v_table, -1, sizeof(env->tlb_v_table));
- memset(cpu->tb_jmp_cache, 0, sizeof(cpu->tb_jmp_cache));
+ tb_flush_jmp_cache_all(cpu);
env->vtlb_index = 0;
env->tlb_flush_addr = -1;
@@ -256,6 +256,12 @@ struct TranslationBlock {
};
void tb_free(TranslationBlock *tb);
+/**
+ * tb_flush_jmp_cache_all:
+ *
+ * Flush the virtual translation block cache.
+ */
+void tb_flush_jmp_cache_all(CPUState *env);
void tb_flush(CPUState *cpu);
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
@@ -941,11 +941,7 @@ static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count)
}
CPU_FOREACH(cpu) {
- int i;
-
- for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
- atomic_set(&cpu->tb_jmp_cache[i], NULL);
- }
+ tb_flush_jmp_cache_all(cpu);
}
tcg_ctx.tb_ctx.nb_tbs = 0;
@@ -1741,6 +1737,14 @@ void tb_check_watchpoint(CPUState *cpu)
}
}
+void tb_flush_jmp_cache_all(CPUState *cpu)
+{
+ int i;
+ for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) {
+ atomic_set(&cpu->tb_jmp_cache[i], NULL);
+ }
+}
+
#ifndef CONFIG_USER_ONLY
/* in deterministic execution mode, instructions doing device I/Os
must be at the end of the TB */
The function is reused in later patches. Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> --- cputlb.c | 2 +- include/exec/exec-all.h | 6 ++++++ translate-all.c | 14 +++++++++----- 3 files changed, 16 insertions(+), 6 deletions(-)