From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxnDR-0005X6-Ke for qemu-devel@nongnu.org; Wed, 05 Nov 2008 13:34:53 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxnDP-0005Wc-Pf for qemu-devel@nongnu.org; Wed, 05 Nov 2008 13:34:53 -0500 Received: from [199.232.76.173] (port=39200 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxnDP-0005WV-IH for qemu-devel@nongnu.org; Wed, 05 Nov 2008 13:34:51 -0500 Received: from lizzard.sbs.de ([194.138.37.39]:17527) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KxnDO-00044d-Im for qemu-devel@nongnu.org; Wed, 05 Nov 2008 13:34:51 -0500 Received: from mail1.sbs.de (localhost [127.0.0.1]) by lizzard.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id mA5IYmrf015337 for ; Wed, 5 Nov 2008 19:34:48 +0100 Received: from [139.25.109.167] (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail1.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id mA5IYmA1026651 for ; Wed, 5 Nov 2008 19:34:48 +0100 Message-ID: <4911E748.2030208@siemens.com> Date: Wed, 05 Nov 2008 19:34:48 +0100 From: Jan Kiszka MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [5627] Add KVM support to QEMU 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 Anthony Liguori wrote: > Revision: 5627 > http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5627 > Author: aliguori > Date: 2008-11-05 16:04:33 +0000 (Wed, 05 Nov 2008) > > Log Message: > ----------- > Add KVM support to QEMU > ... > Modified: trunk/target-i386/helper.c > =================================================================== > --- trunk/target-i386/helper.c 2008-11-05 15:34:06 UTC (rev 5626) > +++ trunk/target-i386/helper.c 2008-11-05 16:04:33 UTC (rev 5627) > @@ -29,6 +29,7 @@ > #include "exec-all.h" > #include "svm.h" > #include "qemu-common.h" > +#include "kvm.h" > > //#define DEBUG_MMU > > @@ -115,6 +116,8 @@ > #ifdef USE_KQEMU > kqemu_init(env); > #endif > + if (kvm_enabled()) > + kvm_init_vcpu(env); > return env; > } > > @@ -1288,6 +1291,40 @@ > } > #endif /* !CONFIG_USER_ONLY */ > > +#if defined(CONFIG_KVM) > +static void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, > + uint32_t *ecx, uint32_t *edx) > +{ > + uint32_t vec[4]; > + > +#ifdef __x86_64__ > + asm volatile("cpuid" > + : "=a"(vec[0]), "=b"(vec[1]), > + "=c"(vec[2]), "=d"(vec[3]) > + : "0"(function) : "cc"); > +#else > + asm volatile("pusha \n\t" > + "cpuid \n\t" > + "mov %%eax, 0(%1) \n\t" > + "mov %%ebx, 4(%1) \n\t" > + "mov %%ecx, 8(%1) \n\t" > + "mov %%edx, 12(%1) \n\t" > + "popa" > + : : "a"(function), "S"(vec) > + : "memory", "cc"); > +#endif > + > + if (eax) > + *eax = vec[0]; > + if (ebx) > + *ebx = vec[1]; > + if (ecx) > + *ecx = vec[2]; > + if (edx) > + *edx = vec[3]; > +} > +#endif > + ...and if KVM is disabled, let's keep the compiler happy: ------------> Fix compiler warning for KVM-disabled case. Signed-off-by: Jan Kiszka --- target-i386/helper.c | 3 +++ 1 file changed, 3 insertions(+) Index: b/target-i386/helper.c =================================================================== --- a/target-i386/helper.c +++ b/target-i386/helper.c @@ -1323,6 +1323,9 @@ static void host_cpuid(uint32_t function if (edx) *edx = vec[3]; } +#else +static inline void host_cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, + uint32_t *ecx, uint32_t *edx) { } #endif void cpu_x86_cpuid(CPUX86State *env, uint32_t index,