Skip to content

Commit

Permalink
target/i386: Preserve DisasContextBase.insn_start across rewind
Browse files Browse the repository at this point in the history
When aborting translation of the current insn, restore the
previous value of insn_start.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Apr 8, 2024
1 parent 3780912 commit fb08b0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions target/i386/tcg/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ typedef struct DisasContext {
TCGv_i64 tmp1_i64;

sigjmp_buf jmpbuf;
TCGOp *prev_insn_start;
TCGOp *prev_insn_end;
} DisasContext;

Expand Down Expand Up @@ -3123,6 +3124,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
/* END TODO */
s->base.num_insns--;
tcg_remove_ops_after(s->prev_insn_end);
s->base.insn_start = s->prev_insn_start;
s->base.is_jmp = DISAS_TOO_MANY;
return false;
default:
Expand Down Expand Up @@ -6995,6 +6997,7 @@ static void i386_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
DisasContext *dc = container_of(dcbase, DisasContext, base);
target_ulong pc_arg = dc->base.pc_next;

dc->prev_insn_start = dc->base.insn_start;
dc->prev_insn_end = tcg_last_op();
if (tb_cflags(dcbase->tb) & CF_PCREL) {
pc_arg &= ~TARGET_PAGE_MASK;
Expand Down

0 comments on commit fb08b0f

Please sign in to comment.