qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: YuYeon Oh <yuyeon.oh@samsung.com>,
	qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] target-arm: Don't update base register on abort in Thumb T1 LDM
Date: Wed, 27 Apr 2011 20:18:05 +0200	[thread overview]
Message-ID: <20110427181805.GB12989@volta.aurel32.net> (raw)
In-Reply-To: <1303838240-13582-1-git-send-email-peter.maydell@linaro.org>

On Tue, Apr 26, 2011 at 06:17:20PM +0100, Peter Maydell wrote:
> Make sure the base register isn't updated if it is in the load list
> for a Thumb LDM (T1 encoding) which aborts partway through the load.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  target-arm/translate.c |   17 ++++++++++++++---
>  1 files changed, 14 insertions(+), 3 deletions(-)

Thanks, applied.

> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index d8da514..a1af436 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -9454,7 +9454,10 @@ static void disas_thumb_insn(CPUState *env, DisasContext *s)
>          break;
>  
>      case 12:
> +    {
>          /* load/store multiple */
> +        TCGv loaded_var;
> +        TCGV_UNUSED(loaded_var);
>          rn = (insn >> 8) & 0x7;
>          addr = load_reg(s, rn);
>          for (i = 0; i < 8; i++) {
> @@ -9462,7 +9465,11 @@ static void disas_thumb_insn(CPUState *env, DisasContext *s)
>                  if (insn & (1 << 11)) {
>                      /* load */
>                      tmp = gen_ld32(addr, IS_USER(s));
> -                    store_reg(s, i, tmp);
> +                    if (i == rn) {
> +                        loaded_var = tmp;
> +                    } else {
> +                        store_reg(s, i, tmp);
> +                    }
>                  } else {
>                      /* store */
>                      tmp = load_reg(s, i);
> @@ -9472,14 +9479,18 @@ static void disas_thumb_insn(CPUState *env, DisasContext *s)
>                  tcg_gen_addi_i32(addr, addr, 4);
>              }
>          }
> -        /* Base register writeback.  */
>          if ((insn & (1 << rn)) == 0) {
> +            /* base reg not in list: base register writeback */
>              store_reg(s, rn, addr);
>          } else {
> +            /* base reg in list: if load, complete it now */
> +            if (insn & (1 << 11)) {
> +                store_reg(s, rn, loaded_var);
> +            }
>              tcg_temp_free_i32(addr);
>          }
>          break;
> -
> +    }
>      case 13:
>          /* conditional branch or swi */
>          cond = (insn >> 8) & 0xf;
> -- 
> 1.7.1
> 
> 
> 

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

  reply	other threads:[~2011-04-27 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 17:17 [Qemu-devel] [PATCH] target-arm: Don't update base register on abort in Thumb T1 LDM Peter Maydell
2011-04-27 18:18 ` Aurelien Jarno [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-27  7:14 Yuyeon Oh

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=20110427181805.GB12989@volta.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yuyeon.oh@samsung.com \
    /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).