From: =?UTF-8?B?U3RlcGhhbiBCw6Ryd29sZg==?= Subject: Re: [PATCH] KVM: x86 emulator: reject SYSENTER in compatibility mode on AMD guests Date: Wed, 01 Feb 2012 11:59:38 +0100 Message-ID: <4F291B1A.4090009@tu-ilmenau.de> References: <1328092020-18511-1-git-send-email-avi@redhat.com> <4F2917D5.2040203@tu-ilmenau.de> <4F291902.60808@redhat.com> Reply-To: stephan.baerwolf@tu-ilmenau.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from wega.rz.tu-ilmenau.de ([141.24.4.159]:58560 "EHLO wega.rz.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954Ab2BALB2 (ORCPT ); Wed, 1 Feb 2012 06:01:28 -0500 In-Reply-To: <4F291902.60808@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 02/01/12 11:50, Avi Kivity wrote: > On 02/01/2012 12:45 PM, Stephan B=C3=A4rwolf wrote: >> On 02/01/12 11:27, Avi Kivity wrote: >>> =20 >>> +static bool vendor_intel(struct x86_emulate_ctxt *ctxt) >>> +{ >>> + u32 eax, ebx, ecx, edx; >> Just to be clean: >> >> Shouldn't eax and ecx be initialized to zero? > Either get_cpuid() initializes them and returns true, or it returns > false and we never evaluate them. This isn't what I mean. CPUID will only return back the VENDOR (in ebx..edx) if you call it with eax=3D0x00000000 and ecx=3D0x00000000 (see cpu docs). Of course the compiler should set these two vars to zero (?) But what if somebody wants to read this code sometime later ?? (The compiler will optimize the "set to zero" away...) regards Stephan