|
From: | Avi Kivity |
Subject: | Re: [Qemu-devel] [PATCH] don't expose lm bit if kernel is not 64-bit capable. |
Date: | Tue, 03 Feb 2009 21:35:58 +0200 |
User-agent: | Thunderbird 2.0.0.19 (X11/20090105) |
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 <inttypes.h> #include <signal.h> #include <assert.h> +#include <sys/utsname.h>#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.
[Prev in Thread] | Current Thread | [Next in Thread] |