@@ -54,6 +54,7 @@ void tb_reset_jump(TranslationBlock *tb, int n);
TranslationBlock *tb_link_page(TranslationBlock *tb);
void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
uintptr_t host_pc);
+void tcg_rebuild_tb_flags(CPUState *cpu);
/**
* tlb_init - initialize a CPU's TLB
@@ -67,6 +67,8 @@ struct TCGCPUOps {
* Fill in all data required to select or compile a TranslationBlock.
*/
TCGTBCPUState (*get_tb_cpu_state)(CPUState *cs);
+ /** @rebuild_tb_hflags: Callback to rebuild TB hflags. */
+ void (*rebuild_tb_hflags)(CPUState *cpu);
/**
* @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock
*
@@ -71,6 +71,14 @@ struct AccelOpsClass {
void (*synchronize_pre_loadvm)(CPUState *cpu);
void (*synchronize_pre_resume)(bool step_pending);
+ /**
+ * rebuild_tcg_tb_flags:
+ *
+ * Used to rebuild TCG TB flags when a hardware accelerator transitions
+ * to TCG, prior to calling TCG %exec_vcpu_thread() handler.
+ */
+ void (*rebuild_tcg_tb_flags)(CPUState *cpu);
+
void (*handle_interrupt)(CPUState *cpu, int mask);
void (*get_vcpu_stats)(CPUState *cpu, GString *buf);
@@ -1028,6 +1028,15 @@ int cpu_exec(CPUState *cpu)
return ret;
}
+void tcg_rebuild_tb_flags(CPUState *cpu)
+{
+ const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops;
+
+ if (tcg_ops->rebuild_tb_hflags) {
+ tcg_ops->rebuild_tb_hflags(cpu);
+ }
+}
+
bool tcg_exec_realizefn(CPUState *cpu, Error **errp)
{
static bool tcg_target_initialized;
@@ -242,6 +242,7 @@ static void tcg_accel_ops_init(AccelClass *ac)
ops->insert_breakpoint = tcg_insert_breakpoint;
ops->remove_breakpoint = tcg_remove_breakpoint;
ops->remove_all_breakpoints = tcg_remove_all_breakpoints;
+ ops->rebuild_tcg_tb_flags = tcg_rebuild_tb_flags;
}
static void tcg_accel_ops_class_init(ObjectClass *oc, const void *data)
In order to allow rebuilding target specific TB flags, introduce tcg_rebuild_tb_flags() which dispatches to a TCGCPUOps handler. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- accel/tcg/internal-common.h | 1 + include/accel/tcg/cpu-ops.h | 2 ++ include/system/accel-ops.h | 8 ++++++++ accel/tcg/cpu-exec.c | 9 +++++++++ accel/tcg/tcg-accel-ops.c | 1 + 5 files changed, 21 insertions(+)