]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-i386: Fix mulx for identical target regs
authorRichard Henderson <rth@twiddle.net>
Tue, 17 Nov 2015 11:41:47 +0000 (12:41 +0100)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 17 Nov 2015 19:05:59 +0000 (17:05 -0200)
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>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
target-i386/translate.c

index fbe4f80aa670676fa2cdbad901669a409b428cb2..a3dd167a9b20c0d25d612659908f04c00e0a1ead 100644 (file)
@@ -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
                 }