From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] kvm-unit-test: fix cpuid test Date: Mon, 04 Nov 2013 15:06:47 +0100 Message-ID: <5277A9F7.3060700@redhat.com> References: <20131104140430.GF7513@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46214 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751632Ab3KDOGt (ORCPT ); Mon, 4 Nov 2013 09:06:49 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA4E6nuX002699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 4 Nov 2013 09:06:49 -0500 In-Reply-To: <20131104140430.GF7513@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 04/11/2013 15:04, Gleb Natapov ha scritto: > If cpuid is called with function value greater than max supported one > max supported value is used instead and index parameter is honored. That > is why we need to initialize index to same value in the test to get > same result from both cpuid invocations. > > diff --git a/x86/realmode.c b/x86/realmode.c > index c57e033..0e1cd37 100644 > --- a/x86/realmode.c > +++ b/x86/realmode.c > @@ -1375,6 +1375,7 @@ static void test_cpuid(void) > unsigned eax, ebx, ecx, edx; > > inregs.eax = eax = function; > + inregs.ecx = ecx = 0; > 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, > -- > Gleb. > Reviewed-by: Paolo Bonzini