Patchwork [2/3] tcg/arm: fix qemu_st64 for big endian targets

login
register
mail settings
Submitter Aurelien Jarno
Date Jan. 6, 2011, 9:54 p.m.
Message ID <1294350874-6885-2-git-send-email-aurelien@aurel32.net>
Download mbox | patch
Permalink /patch/77811/
State New
Headers show

Comments

Aurelien Jarno - Jan. 6, 2011, 9:54 p.m.
Due to a typo, qemu_st64 doesn't properly byteswap the 32-bit low word of
a 64 bit word before saving it. This patch fixes that.

Cc: Andrzej Zaborowski <balrog@zabor.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/arm/tcg-target.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
andrzej zaborowski - Jan. 7, 2011, 12:37 p.m.
On 6 January 2011 22:54, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Due to a typo, qemu_st64 doesn't properly byteswap the 32-bit low word of
> a 64 bit word before saving it. This patch fixes that.

This is a good catch.
Acked-by: Andrzej Zaborowski <balrogg@gmail.com>

Cheers

Patch

diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index 9def2e5..08c44c1 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -1248,7 +1248,7 @@  static inline void tcg_out_qemu_st(TCGContext *s, const TCGArg *args, int opc)
             tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg2);
             tcg_out_st32_rwb(s, COND_EQ, TCG_REG_R0, TCG_REG_R1, addr_reg);
             tcg_out_bswap32(s, COND_EQ, TCG_REG_R0, data_reg);
-            tcg_out_st32_12(s, COND_EQ, data_reg, TCG_REG_R1, 4);
+            tcg_out_st32_12(s, COND_EQ, TCG_REG_R0, TCG_REG_R1, 4);
         } else {
             tcg_out_st32_rwb(s, COND_EQ, data_reg, TCG_REG_R1, addr_reg);
             tcg_out_st32_12(s, COND_EQ, data_reg2, TCG_REG_R1, 4);