qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.0] tcg-arm update
@ 2014-03-28 13:16 Richard Henderson
  2014-03-28 13:16 ` [Qemu-devel] [PULL for-2.0] tcg-arm: Avoid ldrd/strd for user-only emulation Richard Henderson
  2014-03-28 15:31 ` [Qemu-devel] [PULL for-2.0] tcg-arm update Peter Maydell
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2014-03-28 13:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

Just the one unaligned related patch to sneek in under the wire.


r~



The following changes since commit 9c5793c5036c7608ff2c87846c6d11f904c08b58:

  Merge remote-tracking branch 'remotes/afaerber/tags/ppc-for-2.0' into staging (2014-03-27 17:08:30 +0000)

are available in the git repository at:


  git://github.com/rth7680/qemu.git tcg-arm-unaligned

for you to fetch changes up to 1a8e80d7e82aa385ad887dba5d039e399a18264b:

  tcg-arm: Avoid ldrd/strd for user-only emulation (2014-03-27 16:33:01 -0400)

----------------------------------------------------------------
Richard Henderson (1):
      tcg-arm: Avoid ldrd/strd for user-only emulation

 tcg/arm/tcg-target.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Qemu-devel] [PULL for-2.0] tcg-arm: Avoid ldrd/strd for user-only emulation
  2014-03-28 13:16 [Qemu-devel] [PULL for-2.0] tcg-arm update Richard Henderson
@ 2014-03-28 13:16 ` Richard Henderson
  2014-03-28 15:31 ` [Qemu-devel] [PULL for-2.0] tcg-arm update Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2014-03-28 13:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell

The arm ldrd/strd insns must cause alignment traps, whereas
at least for armv7 ldr/str must handle unaligned operations.

While this is hardly the only problem facing user-only emu,
this solves one problem for i386 on armv7 emulation.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reported-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/arm/tcg-target.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
index c8884b3..a65fc65 100644
--- a/tcg/arm/tcg-target.c
+++ b/tcg/arm/tcg-target.c
@@ -60,6 +60,13 @@ static int arm_arch = __ARM_ARCH;
 bool use_idiv_instructions;
 #endif
 
+/* ??? Ought to think about changing CONFIG_SOFTMMU to always defined.  */
+#ifdef CONFIG_SOFTMMU
+# define USING_SOFTMMU 1
+#else
+# define USING_SOFTMMU 0
+#endif
+
 #ifndef NDEBUG
 static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
     "%r0",
@@ -1404,7 +1411,9 @@ static inline void tcg_out_qemu_ld_index(TCGContext *s, TCGMemOp opc,
             TCGReg dl = (bswap ? datahi : datalo);
             TCGReg dh = (bswap ? datalo : datahi);
 
-            if (use_armv6_instructions && (dl & 1) == 0 && dh == dl + 1) {
+            /* Avoid ldrd for user-only emulation, to handle unaligned.  */
+            if (USING_SOFTMMU && use_armv6_instructions
+                && (dl & 1) == 0 && dh == dl + 1) {
                 tcg_out_ldrd_r(s, COND_AL, dl, addrlo, addend);
             } else if (dl != addend) {
                 tcg_out_ld32_rwb(s, COND_AL, dl, addend, addrlo);
@@ -1463,7 +1472,9 @@ static inline void tcg_out_qemu_ld_direct(TCGContext *s, TCGMemOp opc,
             TCGReg dl = (bswap ? datahi : datalo);
             TCGReg dh = (bswap ? datalo : datahi);
 
-            if (use_armv6_instructions && (dl & 1) == 0 && dh == dl + 1) {
+            /* Avoid ldrd for user-only emulation, to handle unaligned.  */
+            if (USING_SOFTMMU && use_armv6_instructions
+                && (dl & 1) == 0 && dh == dl + 1) {
                 tcg_out_ldrd_8(s, COND_AL, dl, addrlo, 0);
             } else if (dl == addrlo) {
                 tcg_out_ld32_12(s, COND_AL, dh, addrlo, bswap ? 0 : 4);
@@ -1548,12 +1559,13 @@ static inline void tcg_out_qemu_st_index(TCGContext *s, int cond, TCGMemOp opc,
         }
         break;
     case MO_64:
+        /* Avoid strd for user-only emulation, to handle unaligned.  */
         if (bswap) {
             tcg_out_bswap32(s, cond, TCG_REG_R0, datahi);
             tcg_out_st32_rwb(s, cond, TCG_REG_R0, addend, addrlo);
             tcg_out_bswap32(s, cond, TCG_REG_R0, datalo);
             tcg_out_st32_12(s, cond, TCG_REG_R0, addend, 4);
-        } else if (use_armv6_instructions
+        } else if (USING_SOFTMMU && use_armv6_instructions
                    && (datalo & 1) == 0 && datahi == datalo + 1) {
             tcg_out_strd_r(s, cond, datalo, addrlo, addend);
         } else {
@@ -1592,12 +1604,13 @@ static inline void tcg_out_qemu_st_direct(TCGContext *s, TCGMemOp opc,
         }
         break;
     case MO_64:
+        /* Avoid strd for user-only emulation, to handle unaligned.  */
         if (bswap) {
             tcg_out_bswap32(s, COND_AL, TCG_REG_R0, datahi);
             tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addrlo, 0);
             tcg_out_bswap32(s, COND_AL, TCG_REG_R0, datalo);
             tcg_out_st32_12(s, COND_AL, TCG_REG_R0, addrlo, 4);
-        } else if (use_armv6_instructions
+        } else if (USING_SOFTMMU && use_armv6_instructions
                    && (datalo & 1) == 0 && datahi == datalo + 1) {
             tcg_out_strd_8(s, COND_AL, datalo, addrlo, 0);
         } else {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PULL for-2.0] tcg-arm update
  2014-03-28 13:16 [Qemu-devel] [PULL for-2.0] tcg-arm update Richard Henderson
  2014-03-28 13:16 ` [Qemu-devel] [PULL for-2.0] tcg-arm: Avoid ldrd/strd for user-only emulation Richard Henderson
@ 2014-03-28 15:31 ` Peter Maydell
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-03-28 15:31 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Developers

On 28 March 2014 13:16, Richard Henderson <rth@twiddle.net> wrote:
> Just the one unaligned related patch to sneek in under the wire.
>
>
> r~
>
>
>
> The following changes since commit 9c5793c5036c7608ff2c87846c6d11f904c08b58:
>
>   Merge remote-tracking branch 'remotes/afaerber/tags/ppc-for-2.0' into staging (2014-03-27 17:08:30 +0000)
>
> are available in the git repository at:
>
>
>   git://github.com/rth7680/qemu.git tcg-arm-unaligned
>
> for you to fetch changes up to 1a8e80d7e82aa385ad887dba5d039e399a18264b:
>
>   tcg-arm: Avoid ldrd/strd for user-only emulation (2014-03-27 16:33:01 -0400)
>
> ----------------------------------------------------------------
> Richard Henderson (1):
>       tcg-arm: Avoid ldrd/strd for user-only emulation
>
>  tcg/arm/tcg-target.c | 21 +++++++++++++++++----
>  1 file changed, 17 insertions(+), 4 deletions(-)

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-28 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-28 13:16 [Qemu-devel] [PULL for-2.0] tcg-arm update Richard Henderson
2014-03-28 13:16 ` [Qemu-devel] [PULL for-2.0] tcg-arm: Avoid ldrd/strd for user-only emulation Richard Henderson
2014-03-28 15:31 ` [Qemu-devel] [PULL for-2.0] tcg-arm update Peter Maydell

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).