The movdqa instruction performs a 128-bit vector move and requires that operands are aligned in memory. Unlike the movdqu instruction, a #GP is raised if operands are unaligned. This patch does not exercise misalignment because the CPU detects misalignment while still inside the guest and raises #GP. The emulator will therefore never meet unaligned movdqa instructions. Also change "read"/"write" to "store"/"load" to make it obvious whether the test transfers to or from memory. Previous usage of "read" and "write" was misleading. Signed-off-by: Stefan Hajnoczi <stefanha@xxxxxxxxxxxxxxxxxx> --- This test is expected to fail until a patch is merged that implements the missing movdqa instruction. x86/emulator.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/x86/emulator.c b/x86/emulator.c index b584122..327f871 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -598,12 +598,20 @@ static void test_sse(sse_union *mem) write_cr0(read_cr0() & ~6); /* EM, TS */ write_cr4(read_cr4() | 0x200); /* OSFXSR */ + v.u[0] = 1; v.u[1] = 2; v.u[2] = 3; v.u[3] = 4; asm("movdqu %1, %0" : "=m"(*mem) : "x"(v.sse)); - report("movdqu (read)", sseeq(&v, mem)); + report("movdqu (store)", sseeq(&v, mem)); mem->u[0] = 5; mem->u[1] = 6; mem->u[2] = 7; mem->u[3] = 8; asm("movdqu %1, %0" : "=x"(v.sse) : "m"(*mem)); - report("movdqu (write)", sseeq(mem, &v)); + report("movdqu (load)", sseeq(mem, &v)); + + v.u[0] = 1; v.u[1] = 2; v.u[2] = 3; v.u[3] = 4; + asm("movdqa %1, %0" : "=m"(*mem) : "x"(v.sse)); + report("movdqa (store)", sseeq(&v, mem)); + mem->u[0] = 5; mem->u[1] = 6; mem->u[2] = 7; mem->u[3] = 8; + asm("movdqa %1, %0" : "=x"(v.sse) : "m"(*mem)); + report("movdqa (load)", sseeq(mem, &v)); } static void test_rip_relative(unsigned *mem, char *insn_ram) -- 1.7.7.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html