Skip to contentSkip to conversation

emulator: test mmx movq

PATCH New Avi Kivity 1 participant 1 message Mar 22, 2012 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 emulator: test mmx movq

---
 x86/emulator.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
x86/emulator.c +15 -0
index b584122..6590618 100644
@@ -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);
 
Signature · 1 line
1.7.9