aboutsummaryrefslogtreecommitdiff
path: root/accel/tcg/translator.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-04-02 19:28:20 -1000
committerRichard Henderson <richard.henderson@linaro.org>2024-05-15 08:54:32 +0200
commitddfa9f11766c532209d4ce848c12761d28730338 (patch)
tree0a07c7bf648eb3de57ff7a936369e556b97d2c24 /accel/tcg/translator.c
parent04f8ed114545f01a2fee1121e862e270cdd46741 (diff)
accel/tcg: Cap the translation block when we encounter mmio
Do not allow translation to proceed beyond one insn with mmio, as we will not be caching the TranslationBlock. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'accel/tcg/translator.c')
-rw-r--r--accel/tcg/translator.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index 0848026935..18138c61e1 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -240,6 +240,8 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db,
/* Use slow path if first page is MMIO. */
if (unlikely(tb_page_addr0(tb) == -1)) {
+ /* We capped translation with first page MMIO in tb_gen_code. */
+ tcg_debug_assert(db->max_insns == 1);
return false;
}
@@ -288,6 +290,8 @@ static bool translator_ld(CPUArchState *env, DisasContextBase *db,
if (unlikely(new_page1 == -1)) {
tb_unlock_pages(tb);
tb_set_page_addr0(tb, -1);
+ /* Require that this be the final insn. */
+ db->max_insns = db->num_insns;
return false;
}