qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [5627] Add KVM support to QEMU


From: Jan Kiszka
Subject: [Qemu-devel] Re: [5627] Add KVM support to QEMU
Date: Wed, 05 Nov 2008 19:34:48 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

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 <address@hidden>
---
 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,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]