qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: guoguangyao <guoguangyao18@mails.ucas.ac.cn>, qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, eduardo@habkost.net
Subject: Re: [PATCH] target/i386: Eip error in x86_64-softmmu
Date: Mon, 15 Jan 2024 13:52:03 +1100	[thread overview]
Message-ID: <244768ca-35d6-40c9-8a1b-f5d2eed39aee@linaro.org> (raw)
In-Reply-To: <20240115020804.30272-1-guoguangyao18@mails.ucas.ac.cn>

On 1/15/24 13:08, guoguangyao wrote:
> When closing PCREL, qemu-system-x86_64 run into error.
> Eip modification here leads to the result. Using s->pc
> in func gen_update_eip_next() solves the problem.
> 
> Fixes: b5e0d5d22fbf("target/i386: Fix 32-bit wrapping of pc/eip computation")
> 
> Signed-off-by: guoguangyao <guoguangyao18@mails.ucas.ac.cn>
> 
> 	modified:   target/i386/tcg/translate.c
> ---
>   target/i386/tcg/translate.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

> 
> diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
> index e1eb82a5c6..6f57d5a8a5 100644
> --- a/target/i386/tcg/translate.c
> +++ b/target/i386/tcg/translate.c
> @@ -567,9 +567,9 @@ static void gen_update_eip_next(DisasContext *s)
>       if (tb_cflags(s->base.tb) & CF_PCREL) {
>           tcg_gen_addi_tl(cpu_eip, cpu_eip, s->pc - s->pc_save);
>       } else if (CODE64(s)) {
> -        tcg_gen_movi_tl(cpu_eip, s->base.pc_next);
> +        tcg_gen_movi_tl(cpu_eip, s->pc);
>       } else {
> -        tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->base.pc_next - s->cs_base));
> +        tcg_gen_movi_tl(cpu_eip, (uint32_t)(s->pc - s->cs_base));
>       }
>       s->pc_save = s->pc;
>   }



  reply	other threads:[~2024-01-15  2:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15  2:08 [PATCH] target/i386: Eip error in x86_64-softmmu guoguangyao
2024-01-15  2:52 ` Richard Henderson [this message]
2024-01-15  6:31 ` Michael Tokarev
2024-02-17  9:21 ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=244768ca-35d6-40c9-8a1b-f5d2eed39aee@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=eduardo@habkost.net \
    --cc=guoguangyao18@mails.ucas.ac.cn \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).