]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
target-i386: Make x86 mfence and lfence illegal without SSE2
authorMartin Simmons <martin@lispworks.com>
Mon, 6 Jun 2011 14:49:17 +0000 (15:49 +0100)
committerStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Wed, 8 Jun 2011 08:04:29 +0000 (09:04 +0100)
While trying to use qemu -cpu pentium3 to test for incorrect uses of certain
SSE2 instructions, I found that QEMU allowed the mfence and lfence
instructions to be executed even though Pentium 3 doesn't support them.

According to the processor specs (and experience on a real Pentium 3), these
instructions are only available with SSE2, but QEMU is checking for SSE.  The
check for the related sfence instruction is correct (it works with SSE).

This trival patch fixes the test.

Signed-off-by: Martin Simmons <martin@lispworks.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
target-i386/translate.c

index 199302e517fc677dc984c8ebfe4f53aa60372164..10bd72a0e22ba9868c97d7573f0f7a4559e73990 100644 (file)
@@ -7538,7 +7538,7 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
             break;
         case 5: /* lfence */
         case 6: /* mfence */
-            if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE))
+            if ((modrm & 0xc7) != 0xc0 || !(s->cpuid_features & CPUID_SSE2))
                 goto illegal_op;
             break;
         case 7: /* sfence / clflush */