volatile sig_atomic_t exit_request;
+/*
+ * QEMU emulate can happens because of MMIO or emulation mode, i.e. non-PG mode,
+ * when it's because of MMIO, the MMIO, the interrupt should not be emulated,
+ * because MMIO is emulated for only one instruction now and then back to
+ * HAX kernel
+ */
static int need_handle_intr_request(CPUState *cpu)
{
+#ifdef CONFIG_HAX
+ if (!hax_enabled() || hax_vcpu_emulation_mode(cpu))
+ return cpu->interrupt_request;
+ return 0;
+#else
return cpu->interrupt_request;
+#endif
}
int cpu_exec(CPUArchState *env)
{
-#ifdef CONFIG_HAX
- assert(0);
-#else
CPUState *cpu = ENV_GET_CPU(env);
#if !(defined(CONFIG_USER_ONLY) && \
(defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X)))
}
}
+#ifdef CONFIG_HAX
+ if (hax_enabled() && !hax_vcpu_exec(cpu))
+ longjmp(cpu->jmp_env, 1);
+#endif
+
next_tb = 0; /* force lookup of first TB */
for(;;) {
interrupt_request = need_handle_intr_request(cpu);
cpu_svm_check_intercept_param(env, SVM_EXIT_SMI,
0);
cpu->interrupt_request &= ~CPU_INTERRUPT_SMI;
+#ifdef CONFIG_HAX
+ if (hax_enabled())
+ cpu->hax_vcpu->resync = 1;
+#endif
do_smm_enter(x86_cpu);
next_tb = 0;
} else if ((interrupt_request & CPU_INTERRUPT_NMI) &&
}
}
cpu->current_tb = NULL;
+#ifdef CONFIG_HAX
+ if (hax_enabled() && hax_stop_emulation(cpu))
+ cpu_loop_exit(cpu);
+#endif
/* reset soft MMU for next block (it can currently
only be set by a memory fault) */
} /* for(;;) */
int hax_populate_ram(uint64_t va, uint32_t size);
int hax_set_phys_mem(MemoryRegionSection *section);
int hax_vcpu_emulation_mode(CPUState *cpu);
-/*
int hax_stop_emulation(CPUState *cpu);
int hax_stop_translate(CPUState *cpu);
-*/
int hax_vcpu_destroy(CPUState *cpu);
void hax_raise_event(CPUState *cpu);
void hax_reset_vcpu_state(void *opaque);
if (hax_enabled())
return 0;
- else {
- assert(0);
+ else
return 1;
- }
}
static int hax_prepare_emulation(CPUArchState *env)
{
- assert(0);
/* Flush all emulation states */
tlb_flush(ENV_GET_CPU(env), 1);
tb_flush(env);
* Check whether to break the translation block loop
* break tbloop after one MMIO emulation, or after finish emulation mode
*/
-#if 0
static int hax_stop_tbloop(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
return 0;
}
-#endif
int valid_hax_tunnel_size(uint16_t size)
{
pc_ptr = disas_insn(env, dc, pc_ptr);
num_insns++;
#ifdef CONFIG_HAX
- assert(1);
-/*
if (hax_enabled() && hax_stop_translate(cs))
{
gen_jmp_im(pc_ptr - dc->cs_base);
gen_eob(dc);
break;
}
-*/
#endif
/* stop translation if indicated */
if (dc->is_jmp)