[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-8.2?] target/i386: Fix 32-bit wrapping of pc/eip computat
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH for-8.2?] target/i386: Fix 32-bit wrapping of pc/eip computation |
Date: |
Tue, 12 Dec 2023 22:23:21 +0100 |
On Tue, Dec 12, 2023 at 10:22 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
> > Looks good, but perhaps you could also squash the following?
> >
> > diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
> > index 2c6a12c8350..83ee89579b8 100644
> > --- a/target/i386/tcg/tcg-cpu.c
> > +++ b/target/i386/tcg/tcg-cpu.c
> > @@ -52,7 +52,11 @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
> > /* The instruction pointer is always up to date with CF_PCREL. */
> > if (!(tb_cflags(tb) & CF_PCREL)) {
> > CPUX86State *env = cpu_env(cs);
> > - env->eip = tb->pc - tb->cs_base;
> > + if (tb->flags & HF_CS64_MASK) {
> > + env->eip = tb->pc;
> > + } else {
> > + env->eip = (uint32_t) (tb->pc - tb->cs_base);
> > + }
> > }
> > }
> >
> >
> > It wouldn't be the same bug as 2022 (it wouldn't be new with the vaddr
> > change) so it's okay to sort out this extra case after release.
>
> Good catch, I'll squash it. Thanks.
BTW,
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo