On 2026-09-18 2:42, Yonggang Luo wrote:
Store yield_needed = 0 when raising YIELD, then call
gen_helper_raise_excp with restore 0. Drop TCG exception. Keep
exception_cause helpers. C callers use xtensa_exception for the
old helper_exception body.
Signed-off-by: Yonggang Luo <[email protected]>
---
target/xtensa/cpu.h | 1 +
target/xtensa/exc_helper.c | 13 +++++--------
target/xtensa/helper.h | 1 -
target/xtensa/translate.c | 7 ++++++-
target/xtensa/win_helper.c | 12 ++++++------
5 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 175fd4b5cfc..58fbe8496aa 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -305,7 +305,12 @@ static void gen_left_shift_sar(DisasContext *dc, TCGv_i32
sa)
static void gen_exception(DisasContext *dc, int excp)
{
- gen_helper_exception(tcg_env, tcg_constant_i32(excp));
+ if (excp == EXCP_YIELD) {
+ tcg_gen_st_i32(tcg_constant_i32(0), tcg_env,
+ offsetof(CPUXtensaState, yield_needed));
This is the single call, rename as gen_yield() dropping the if
in a preliminary patch? Otherwise patch LGTM.
+ }
+ gen_helper_raise_excp(tcg_env, tcg_constant_i32(excp),
+ tcg_constant_i32(0));
}