From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LUMp5-0003JC-VY for qemu-devel@nongnu.org; Tue, 03 Feb 2009 10:04:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LUMp4-0003IL-77 for qemu-devel@nongnu.org; Tue, 03 Feb 2009 10:04:23 -0500 Received: from [199.232.76.173] (port=39428 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LUMp3-0003IF-Uk for qemu-devel@nongnu.org; Tue, 03 Feb 2009 10:04:22 -0500 Received: from mx2.redhat.com ([66.187.237.31]:47954) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LUMp3-0003cz-AQ for qemu-devel@nongnu.org; Tue, 03 Feb 2009 10:04:21 -0500 From: Glauber Costa Date: Tue, 3 Feb 2009 10:04:14 -0500 Message-Id: <1233673454-14526-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH] don't expose lm bit if kernel is not 64-bit capable. 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 If the kernel is not 64-bit capable (even if the host machine is) do not expose the lm bit in guest cpuid. Signed-off-by: Glauber Costa --- target-i386/helper.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) 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); host_cpuid(0x80000001, &h_eax, NULL, NULL, &h_edx); /* disable CPU features that the host does not support */ /* long mode */ - if ((h_edx & 0x20000000) == 0 /* || !lm_capable_kernel */) + if ((h_edx & 0x20000000) == 0 || strcmp(utsname.machine, "x86_64")) *edx &= ~0x20000000; /* syscall */ if ((h_edx & 0x00000800) == 0) -- 1.5.6.5