@@ -145,6 +145,16 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
void translator_loop_temp_check(DisasContextBase *db);
+/**
+ * translator_use_goto_tb
+ * @db: Disassembly context
+ * @dest: target pc of the goto
+ *
+ * Return true if goto_tb is allowed between the current TB
+ * and the destination PC.
+ */
+bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest);
+
/*
* Translator Load Functions
*
@@ -31,6 +31,17 @@ void translator_loop_temp_check(DisasContextBase *db)
}
}
+bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest)
+{
+ /* Suppress goto_tb in the case of single-steping. */
+ if (db->singlestep_enabled || singlestep) {
+ return false;
+ }
+
+ /* Check for the dest on the same page as the start of the TB. */
+ return ((db->pc_first ^ dest) & TARGET_PAGE_MASK) == 0;
+}
+
void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
CPUState *cpu, TranslationBlock *tb, int max_insns)
{