All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] tcg: fix deposit_i64 op on 32-bit targets
@ 2013-04-20 22:48 Aurelien Jarno
  2013-04-21  7:31 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Aurelien Jarno @ 2013-04-20 22:48 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Richard Henderson, Aurelien Jarno, Michael S. Tsirkin

On 32-bit TCG targets, when emulating deposit_i64 with a mov_i32 +
deposit_i32, care should be taken to not overwrite the low part of
the second argument before the deposit when it is the same the
destination.

This fixes the shld instruction in qemu-system-x86_64, which in turns
fixes booting "system rescue CD version 2.8.0" on this target.

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 tcg/tcg-op.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index d70b2eb..94f6043 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -2188,9 +2188,9 @@ static inline void tcg_gen_deposit_i64(TCGv_i64 ret, TCGv_i64 arg1,
 
 #if TCG_TARGET_REG_BITS == 32
     if (ofs >= 32) {
-        tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg1));
         tcg_gen_deposit_i32(TCGV_HIGH(ret), TCGV_HIGH(arg1),
                             TCGV_LOW(arg2), ofs - 32, len);
+        tcg_gen_mov_i32(TCGV_LOW(ret), TCGV_LOW(arg1));
         return;
     }
     if (ofs + len <= 32) {
-- 
1.7.10.4

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

* Re: [Qemu-devel] [PATCH] tcg: fix deposit_i64 op on 32-bit targets
  2013-04-20 22:48 [Qemu-devel] [PATCH] tcg: fix deposit_i64 op on 32-bit targets Aurelien Jarno
@ 2013-04-21  7:31 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2013-04-21  7:31 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: Paolo Bonzini, qemu-devel, Michael S. Tsirkin

On 2013-04-21 00:48, Aurelien Jarno wrote:
> On 32-bit TCG targets, when emulating deposit_i64 with a mov_i32 +
> deposit_i32, care should be taken to not overwrite the low part of
> the second argument before the deposit when it is the same the
> destination.
>
> This fixes the shld instruction in qemu-system-x86_64, which in turns
> fixes booting "system rescue CD version 2.8.0" on this target.
>
> Reported-by: Michael S. Tsirkin<mst@redhat.com>
> Cc: Richard Henderson<rth@twiddle.net>
> Cc: Paolo Bonzini<pbonzini@redhat.com>
> Signed-off-by: Aurelien Jarno<aurelien@aurel32.net>

Nice catch.

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~

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

end of thread, other threads:[~2013-04-21  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-20 22:48 [Qemu-devel] [PATCH] tcg: fix deposit_i64 op on 32-bit targets Aurelien Jarno
2013-04-21  7:31 ` Richard Henderson

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.