aboutsummaryrefslogtreecommitdiffstats
path: root/cpus.c
diff options
context:
space:
mode:
authorJun Nakajima <jun.nakajima@intel.com>2011-12-17 19:13:25 -0800
committerJiang, Yunhong <yunhong.jiang@intel.com>2012-01-17 06:15:06 +0800
commita381ef07088ce479610129e37bfef42538f397da (patch)
tree523581dd6c18ddd42bb3980483778a3dd5d6154d /cpus.c
parente7e8b324a626a4ba112c3ad47d54eb9cfd3025ba (diff)
downloadexternal_qemu-a381ef07088ce479610129e37bfef42538f397da.zip
external_qemu-a381ef07088ce479610129e37bfef42538f397da.tar.gz
external_qemu-a381ef07088ce479610129e37bfef42538f397da.tar.bz2
Changes to existing files to add HAX support
HAX (Hardware-based Accelerated eXecution) employes hardware virtualization technology to boost performance of the Android emulator on Mac OS X or Windows hosts. This changeset includes the changes required to the existing files. To pass the compilation, hax.h is added, but CONFIG_HAX is disabled so that no real changes added. Change-Id: Ifa5777e8788e6698747c1ec4cd91315161c2ca0b Signed-off-by: Zhang, Xiantao <xiantao.zhang@intel.com> Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com> Signed-off-by: Jiang Yunhong <yunhong.jiang@intel.com> Signed-off-by: Nakajima, Jun <jun.nakajima@intel.com>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/cpus.c b/cpus.c
index 470eb32..585a6b3 100644
--- a/cpus.c
+++ b/cpus.c
@@ -28,6 +28,7 @@
#include "gdbstub.h"
#include "dma.h"
#include "kvm.h"
+#include "hax.h"
#include "cpus.h"
@@ -191,6 +192,10 @@ void qemu_init_vcpu(void *_env)
if (kvm_enabled())
kvm_init_vcpu(env);
+#ifdef CONFIG_HAX
+ if (hax_enabled())
+ hax_init_vcpu(env);
+#endif
return;
}
@@ -222,7 +227,27 @@ void qemu_notify_event(void)
if (env->kqemu_enabled)
kqemu_cpu_interrupt(env);
#endif
+ /*
+ * This is mainly for the Windows host, where the timer may be in
+ * a different thread with vcpu. Thus the timer function needs to
+ * notify the vcpu thread of more than simply cpu_exit. If env is
+ * not NULL, it means that the vcpu is in execute state, we need
+ * only to set the flags. If the guest is in execute state, the
+ * HAX kernel module will exit to qemu. If env is NULL, vcpu is
+ * in main_loop_wait, and we need a event to notify it.
+ */
+#ifdef CONFIG_HAX
+ if (hax_enabled())
+ hax_raise_event(env);
+ } else {
+#ifdef _WIN32
+ if(hax_enabled())
+ SetEvent(qemu_event_handle);
+#endif
}
+#else
+ }
+#endif
}
void qemu_mutex_lock_iothread(void)
@@ -361,7 +386,7 @@ void qemu_cpu_kick(void *_env)
{
CPUState *env = _env;
qemu_cond_broadcast(env->halt_cond);
- if (kvm_enabled())
+ if (kvm_enabled() || hax_enabled())
qemu_thread_signal(env->thread, SIGUSR1);
}
@@ -425,7 +450,7 @@ static void qemu_signal_lock(unsigned int msecs)
void qemu_mutex_lock_iothread(void)
{
- if (kvm_enabled()) {
+ if (kvm_enabled() || hax_enabled()) {
qemu_mutex_lock(&qemu_fair_mutex);
qemu_mutex_lock(&qemu_global_mutex);
qemu_mutex_unlock(&qemu_fair_mutex);