Signed-off-by: Avi Kivity <a...@redhat.com>
---
 x86/emulator.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/x86/emulator.c b/x86/emulator.c
index b584122..6590618 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -606,6 +606,20 @@ static void test_sse(sse_union *mem)
     report("movdqu (write)", sseeq(mem, &v));
 }
 
+static void test_mmx(uint64_t *mem)
+{
+    uint64_t v;
+
+    write_cr0(read_cr0() & ~6); /* EM, TS */
+    asm volatile("fninit");
+    v = 0x0102030405060708ULL;
+    asm("movq %1, %0" : "=m"(*mem) : "y"(v));
+    report("movq (mmx, read)", v == *mem);
+    *mem = 0x8070605040302010ull;
+    asm("movq %1, %0" : "=y"(v) : "m"(*mem));
+    report("movq (mmx, write)", v == *mem);
+}
+
 static void test_rip_relative(unsigned *mem, char *insn_ram)
 {
     /* movb $1, mem+2(%rip) */
@@ -672,6 +686,7 @@ int main()
        test_imul(mem);
        test_div(mem);
        test_sse(mem);
+       test_mmx(mem);
        test_rip_relative(mem, insn_ram);
        test_shld_shrd(mem);
 
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to