From: Avi Kivity Subject: [PATCH kvm-unit-tests] emulator: test mmx movq Date: Thu, 22 Mar 2012 12:58:52 +0200 Message-ID: <1332413932-3176-1-git-send-email-avi@redhat.com> To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42305 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753475Ab2CVK67 (ORCPT ); Thu, 22 Mar 2012 06:58:59 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2MAwxVu005162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 22 Mar 2012 06:58:59 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2MAwwOn007291 for ; Thu, 22 Mar 2012 06:58:59 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Avi Kivity --- 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