From: Avi Kivity Subject: [PATCH kvm-unit-tests 01/12] realmode: test cpuid Date: Wed, 27 Jun 2012 11:36:30 +0300 Message-ID: <1340786201-27881-2-git-send-email-avi@redhat.com> References: <1340786201-27881-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]:43935 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753821Ab2F0Igs (ORCPT ); Wed, 27 Jun 2012 04:36:48 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5R8alsA025657 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Jun 2012 04:36:48 -0400 In-Reply-To: <1340786201-27881-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Avi Kivity --- x86/realmode.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/x86/realmode.c b/x86/realmode.c index d171a56..a083c7a 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1287,6 +1287,20 @@ void test_jcxz(void) report("jecxz short 2", R_AX, outregs.eax == 0x1234); } +static void test_cpuid(void) +{ + MK_INSN(cpuid, "cpuid"); + unsigned function = 0x1234; + unsigned eax, ebx, ecx, edx; + + inregs.eax = eax = function; + asm("cpuid" : "+a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)); + exec_in_big_real_mode(&insn_cpuid); + report("cpuid", R_AX|R_BX|R_CX|R_DX, + outregs.eax == eax && outregs.ebx == ebx + && outregs.ecx == ecx && outregs.edx == edx); +} + void realmode_start(void) { test_null(); @@ -1320,6 +1334,7 @@ void realmode_start(void) test_das(); test_lds_lss(); test_jcxz(); + test_cpuid(); exit(0); } -- 1.7.11