qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: Fix mulx for identical target regs
@ 2015-11-17 11:41 Richard Henderson
  2015-11-17 14:39 ` Eduardo Habkost
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2015-11-17 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, ehabkost

The Intel specification clearly indicates that the low part
of the result is written first and the high part of the result
is written second; thus if ModRM:reg and VEX.vvvv are identical,
the final result should be the high part of the result.

At present, TCG may either produce incorrect results or crash
with --enable-checking.

Reported-by: Toni Nedialkov <farmdve@gmail.com>
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-i386/translate.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target-i386/translate.c b/target-i386/translate.c
index fbe4f80..a3dd167 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -3848,8 +3848,10 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b,
                     break;
 #ifdef TARGET_X86_64
                 case MO_64:
-                    tcg_gen_mulu2_i64(cpu_regs[s->vex_v], cpu_regs[reg],
+                    tcg_gen_mulu2_i64(cpu_T[0], cpu_T[1],
                                       cpu_T[0], cpu_regs[R_EDX]);
+                    tcg_gen_mov_i64(cpu_regs[s->vex_v], cpu_T[0]);
+                    tcg_gen_mov_i64(cpu_regs[reg], cpu_T[1]);
                     break;
 #endif
                 }
-- 
2.4.3

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

* Re: [Qemu-devel] [PATCH] target-i386: Fix mulx for identical target regs
  2015-11-17 11:41 [Qemu-devel] [PATCH] target-i386: Fix mulx for identical target regs Richard Henderson
@ 2015-11-17 14:39 ` Eduardo Habkost
  0 siblings, 0 replies; 2+ messages in thread
From: Eduardo Habkost @ 2015-11-17 14:39 UTC (permalink / raw)
  To: Richard Henderson; +Cc: pbonzini, qemu-devel

On Tue, Nov 17, 2015 at 12:41:47PM +0100, Richard Henderson wrote:
> The Intel specification clearly indicates that the low part
> of the result is written first and the high part of the result
> is written second; thus if ModRM:reg and VEX.vvvv are identical,
> the final result should be the high part of the result.
> 
> At present, TCG may either produce incorrect results or crash
> with --enable-checking.
> 
> Reported-by: Toni Nedialkov <farmdve@gmail.com>
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Richard Henderson <rth@twiddle.net>

Applied to x86 tree. Thanks!

-- 
Eduardo

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

end of thread, other threads:[~2015-11-17 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-17 11:41 [Qemu-devel] [PATCH] target-i386: Fix mulx for identical target regs Richard Henderson
2015-11-17 14:39 ` Eduardo Habkost

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