From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUR5Q-0003qC-T4 for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:37:33 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUR5P-0003p2-5k for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:37:32 -0500 Received: from [199.232.76.173] (port=42549 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUR5O-0003op-Qp for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:37:30 -0500 Received: from mx2.redhat.com ([66.187.237.31]:60717) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUR5N-0004fh-Lx for qemu-devel@nongnu.org; Tue, 03 Feb 2009 14:37:30 -0500 Message-ID: <49889CEB.7060602@redhat.com> Date: Tue, 03 Feb 2009 21:37:15 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] don't expose lm bit if kernel is not 64-bit capable. References: <1233673454-14526-1-git-send-email-glommer@redhat.com> In-Reply-To: <1233673454-14526-1-git-send-email-glommer@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com Glauber Costa wrote: > If the kernel is not 64-bit capable (even if the host > machine is) do not expose the lm bit in guest cpuid. > > > diff --git a/target-i386/helper.c b/target-i386/helper.c > index a28ab93..997e4e1 100644 > --- a/target-i386/helper.c > +++ b/target-i386/helper.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > #include "cpu.h" > #include "exec-all.h" > @@ -1520,13 +1521,16 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, > > if (kvm_enabled()) { > uint32_t h_eax, h_edx; > + struct utsname utsname; > + > + uname(&utsname); > It would be better to use KVM_GET_SUPPORTED_CPUID for this (and similar). uname() can lie, and in theory kvm can support x86_64 on i386 kernels (although patches to implement this would be rejected on cost/benefit and aesthetic concerns). -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.