Commit 219748ce2c for qemu.org
commit 219748ce2c6cfc3c58517681d4429d3666a59495
Author: Brian Cain <brian.cain@oss.qualcomm.com>
Date: Tue Nov 24 11:03:10 2026 -0800
target/hexagon: fix get_exe_mode assertion in hexagon_stop_thread
When a thread in WAIT mode (W=1, E=1) executes a STOP instruction,
hexagon_stop_thread must clear the wait-mode bit before clearing
the enable bit. Without this, clear_enable_mask creates a transient
(W=1, E=0) state in MODECTL that triggers g_assert_not_reached() in
get_exe_mode() when another thread iterates all CPUs via
hex_interrupt_update.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
diff --git a/target/hexagon/cpu_helper.c b/target/hexagon/cpu_helper.c
index f53d377ab1..680dcf5680 100644
--- a/target/hexagon/cpu_helper.c
+++ b/target/hexagon/cpu_helper.c
@@ -441,6 +441,7 @@ void hexagon_stop_thread(CPUHexagonState *env)
BQL_LOCK_GUARD();
+ clear_wait_mode(env);
thread_enabled_mask = clear_enable_mask(env);
cs = env_cpu(env);
cpu_interrupt(cs, CPU_INTERRUPT_HALT);