gen_exception has one caller, and that caller always passes EXCP_YIELD. Rename the path to gen_yield and clear yield_needed there.
Signed-off-by: Yonggang Luo <[email protected]> --- target/xtensa/translate.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 175fd4b5cfc..db48f0c562a 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -303,9 +303,11 @@ static void gen_left_shift_sar(DisasContext *dc, TCGv_i32 sa) dc->sar_m32_5bit = true; } -static void gen_exception(DisasContext *dc, int excp) +static void gen_yield(DisasContext *dc) { - gen_helper_exception(tcg_env, tcg_constant_i32(excp)); + tcg_gen_st_i32(tcg_constant_i32(0), tcg_env, + offsetof(CPUXtensaState, yield_needed)); + gen_helper_exception(tcg_env, tcg_constant_i32(EXCP_YIELD)); } static void gen_exception_cause(DisasContext *dc, uint32_t cause) @@ -1167,7 +1169,7 @@ static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) but this is the first TranslateOps hook that allows exiting. */ if ((tb_cflags(dc->base.tb) & CF_USE_ICOUNT) && (dc->base.tb->flags & XTENSA_TBFLAG_YIELD)) { - gen_exception(dc, EXCP_YIELD); + gen_yield(dc); dc->base.pc_next = dc->pc + 1; dc->base.is_jmp = DISAS_NORETURN; return; -- 2.52.0.windows.1
