Commit f8cb32336e for qemu.org
commit f8cb32336e61ad98b1cff710a362906544bbee37
Author: Marco Liebel <marco.liebel@oss.qualcomm.com>
Date: Tue Nov 24 11:03:09 2026 -0800
target/hexagon: bound packet lookahead to the current page
Do not fetch an unmapped page while deciding where to end a TB.
This lets complete packets retire before a straddling packet faults,
and preserves the correct packet restart address.
Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c
index 11b3917b96..796d32bff9 100644
--- a/target/hexagon/translate.c
+++ b/target/hexagon/translate.c
@@ -1621,6 +1621,11 @@ static bool pkt_crosses_page(CPUHexagonState *env, DisasContext *ctx)
int nwords;
for (nwords = 0; !found_end && nwords < PACKET_WORDS_MAX; nwords++) {
+ /* Look ahead only on this page; a fault must not discard this TB. */
+ if (ctx->base.pc_next + nwords * sizeof(uint32_t) - page_start >=
+ TARGET_PAGE_SIZE) {
+ return true;
+ }
uint32_t word = translator_ldl_end(env, &ctx->base,
ctx->base.pc_next
+ nwords * sizeof(uint32_t),