target/i386: Preserve DisasContextBase.insn_start across rewind

When aborting translation of the current insn, restore the
previous value of insn_start.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Jørgen Hansen <Jorgen.Hansen@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2024-04-06 11:05:12 -10:00
parent 24638bd17d
commit 8df1ba49d7

View File

@ -139,6 +139,7 @@ typedef struct DisasContext {
TCGv_i64 tmp1_i64; TCGv_i64 tmp1_i64;
sigjmp_buf jmpbuf; sigjmp_buf jmpbuf;
TCGOp *prev_insn_start;
TCGOp *prev_insn_end; TCGOp *prev_insn_end;
} DisasContext; } DisasContext;
@ -3123,6 +3124,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
/* END TODO */ /* END TODO */
s->base.num_insns--; s->base.num_insns--;
tcg_remove_ops_after(s->prev_insn_end); tcg_remove_ops_after(s->prev_insn_end);
s->base.insn_start = s->prev_insn_start;
s->base.is_jmp = DISAS_TOO_MANY; s->base.is_jmp = DISAS_TOO_MANY;
return false; return false;
default: default:
@ -6995,6 +6997,7 @@ static void i386_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu)
DisasContext *dc = container_of(dcbase, DisasContext, base); DisasContext *dc = container_of(dcbase, DisasContext, base);
target_ulong pc_arg = dc->base.pc_next; target_ulong pc_arg = dc->base.pc_next;
dc->prev_insn_start = dc->base.insn_start;
dc->prev_insn_end = tcg_last_op(); dc->prev_insn_end = tcg_last_op();
if (tb_cflags(dcbase->tb) & CF_PCREL) { if (tb_cflags(dcbase->tb) & CF_PCREL) {
pc_arg &= ~TARGET_PAGE_MASK; pc_arg &= ~TARGET_PAGE_MASK;