From a381ef07088ce479610129e37bfef42538f397da Mon Sep 17 00:00:00 2001 From: Jun Nakajima Date: Sat, 17 Dec 2011 19:13:25 -0800 Subject: 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 Signed-off-by: Xin, Xiaohui Signed-off-by: Jiang Yunhong Signed-off-by: Nakajima, Jun --- cpu-exec.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'cpu-exec.c') 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(;;) */ -- cgit v1.1