All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Laurent Desnogues <laurent.desnogues@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] i386 target: fix ARPL
Date: Mon, 5 Oct 2009 23:56:06 +0200	[thread overview]
Message-ID: <20091005215606.GA22831@volta.aurel32.net> (raw)
In-Reply-To: <761ea48b0910050818g6d3e9974h51a2d1d11fde5ee6@mail.gmail.com>

On Mon, Oct 05, 2009 at 05:18:26PM +0200, Laurent Desnogues wrote:
> Hello,
> 
> The arpl implementation in target-i386/translate.c uses cpu_A0
> temporary across a brcond op.  This patch fixes that issue.
> 
> Note I didn't test it, I only looked at generated code to check it
> was making sense.

This looks indeed correct. I wonder however if it would be better to do
the tcg_temp_local_new() / tcg_temp_free() in the if (mod != 3) path
only.

Also this patch needs a Signed-of-by:

Aurelien
 
> diff --git a/target-i386/translate.c b/target-i386/translate.c
> index e3cb49f..807707f 100644
> --- a/target-i386/translate.c
> +++ b/target-i386/translate.c
> @@ -7305,13 +7305,14 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
>  #endif
>          {
>              int label1;
> -            TCGv t0, t1, t2;
> +            TCGv t0, t1, t2, a0;
>  
>              if (!s->pe || s->vm86)
>                  goto illegal_op;
>              t0 = tcg_temp_local_new();
>              t1 = tcg_temp_local_new();
>              t2 = tcg_temp_local_new();
> +            a0 = tcg_temp_local_new();
>              ot = OT_WORD;
>              modrm = ldub_code(s->pc++);
>              reg = (modrm >> 3) & 7;
> @@ -7320,6 +7321,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
>              if (mod != 3) {
>                  gen_lea_modrm(s, modrm, &reg_addr, &offset_addr);
>                  gen_op_ld_v(ot + s->mem_index, t0, cpu_A0);
> +                tcg_gen_mov_tl(a0, cpu_A0);
>              } else {
>                  gen_op_mov_v_reg(ot, t0, rm);
>              }
> @@ -7334,7 +7336,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
>              tcg_gen_movi_tl(t2, CC_Z);
>              gen_set_label(label1);
>              if (mod != 3) {
> -                gen_op_st_v(ot + s->mem_index, t0, cpu_A0);
> +                gen_op_st_v(ot + s->mem_index, t0, a0);
>              } else {
>                  gen_op_mov_reg_v(ot, rm, t0);
>              }
> @@ -7347,6 +7349,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
>              tcg_temp_free(t0);
>              tcg_temp_free(t1);
>              tcg_temp_free(t2);
> +            tcg_temp_free(a0);
>          }
>          break;
>      case 0x102: /* lar */


-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2009-10-05 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05 15:18 [Qemu-devel] [PATCH] i386 target: fix ARPL Laurent Desnogues
2009-10-05 21:56 ` Aurelien Jarno [this message]
2009-10-06 14:29   ` Laurent Desnogues
2009-10-06 14:21 ` Anthony Liguori

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=20091005215606.GA22831@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=laurent.desnogues@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.