aboutsummaryrefslogtreecommitdiffstats
path: root/cpu-exec.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 /cpu-exec.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 'cpu-exec.c')
-rw-r--r--cpu-exec.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 92fae21..c6572f1 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -21,6 +21,7 @@
#include "disas.h"
#include "tcg.h"
#include "kvm.h"
+#include "hax.h"
#include "qemu-barrier.h"
#if !defined(CONFIG_SOFTMMU)
@@ -223,6 +224,23 @@ static void cpu_handle_debug_exception(CPUState *env)
volatile sig_atomic_t exit_request;
+/*
+ * Qemu emulation can happen because of MMIO or emulation mode,
+ * i.e. non-PG mode. For MMIO cases, the pending interrupt should not
+ * be emulated in qemu because MMIO is emulated for only one
+ * instruction now and then back to the HAX kernel module.
+ */
+int need_handle_intr_request(CPUState *env)
+{
+#ifdef CONFIG_HAX
+ if (!hax_enabled() || hax_vcpu_emulation_mode(env))
+ return env->interrupt_request;
+ return 0;
+#else
+ return env->interrupt_request;
+#endif
+}
+
int cpu_exec(CPUState *env1)
{
volatile host_reg_t saved_env_reg;
@@ -355,6 +373,11 @@ int cpu_exec(CPUState *env1)
}
}
+#ifdef CONFIG_HAX
+ if (hax_enabled() && !hax_vcpu_exec(env))
+ longjmp(env->jmp_env, 1);
+#endif
+
if (kvm_enabled()) {
kvm_cpu_exec(env);
longjmp(env->jmp_env, 1);
@@ -363,7 +386,7 @@ int cpu_exec(CPUState *env1)
next_tb = 0; /* force lookup of first TB */
for(;;) {
interrupt_request = env->interrupt_request;
- if (unlikely(interrupt_request)) {
+ if (unlikely(need_handle_intr_request(env))) {
if (unlikely(env->singlestep_enabled & SSTEP_NOIRQ)) {
/* Mask out external interrupts for this step. */
interrupt_request &= ~CPU_INTERRUPT_SSTEP_MASK;
@@ -669,6 +692,10 @@ int cpu_exec(CPUState *env1)
}
}
env->current_tb = NULL;
+#ifdef CONFIG_HAX
+ if (hax_enabled() && hax_stop_emulation(env))
+ cpu_loop_exit();
+#endif
/* reset soft MMU for next block (it can currently
only be set by a memory fault) */
} /* for(;;) */