Set PC to the k0lock instruction before halting a contended thread. A stale PC can skip the acquired lock or resume at unrelated guest code.
Signed-off-by: Brian Cain <[email protected]> --- target/hexagon/op_helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 6784efddc9f..56cf601ef1d 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -1314,6 +1314,7 @@ static void hex_k0_lock(CPUHexagonState *env) return; } env->k0_lock_state = HEX_LOCK_WAITING; + env->gpr[HEX_REG_PC] = env->next_PC - 4; cpu_interrupt(cs, CPU_INTERRUPT_HALT); cpu_loop_exit(cs); } else { -- 2.34.1
