From: Jan Kiszka <jan.kiszka@siemens.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [5627] Add KVM support to QEMU
Date: Wed, 05 Nov 2008 19:34:48 +0100 [thread overview]
Message-ID: <4911E748.2030208@siemens.com> (raw)
In-Reply-To: <E1Kxkrx-0006Lk-OG@cvs.savannah.gnu.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 <jan.kiszka@siemens.com>
---
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,
next prev parent reply other threads:[~2008-11-05 18:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-05 16:04 [Qemu-devel] [5627] Add KVM support to QEMU Anthony Liguori
2008-11-05 16:19 ` andrzej zaborowski
2008-11-05 16:30 ` Anthony Liguori
2008-11-05 18:34 ` Jan Kiszka [this message]
2008-11-12 10:42 ` Christoph Hellwig
2008-11-13 19:56 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4911E748.2030208@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).