From: SeokYeon Hwang Date: Fri, 7 Nov 2014 02:42:34 +0000 (+0900) Subject: Revert "hax: for testing..." X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~633 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cd9e2df19687441653d05333c26790aed2303c0;p=sdk%2Femulator%2Fqemu.git Revert "hax: for testing..." This reverts commit 57a0d655687a503ab76db51942543c9b8812a941. --- diff --git a/cpu-exec.c b/cpu-exec.c index c3d4b7b0da..64a6150fc0 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -214,17 +214,26 @@ static void cpu_handle_debug_exception(CPUArchState *env) 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))) @@ -322,6 +331,11 @@ int cpu_exec(CPUArchState *env) } } +#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); @@ -366,6 +380,10 @@ int cpu_exec(CPUArchState *env) 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) && @@ -691,6 +709,10 @@ int cpu_exec(CPUArchState *env) } } 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(;;) */ diff --git a/cpus.c b/cpus.c index 226dbc4822..b28a92a0f0 100644 --- a/cpus.c +++ b/cpus.c @@ -1182,6 +1182,10 @@ void resume_all_vcpus(void) static void qemu_tcg_init_vcpu(CPUState *cpu) { +#ifdef CONFIG_HAX + if (hax_enabled()) + hax_init_vcpu(cpu); +#endif char thread_name[VCPU_THREAD_NAME_SIZE]; tcg_cpu_address_space_init(cpu, cpu->as); diff --git a/include/sysemu/hax.h b/include/sysemu/hax.h index a2c6da4880..3b6783867c 100644 --- a/include/sysemu/hax.h +++ b/include/sysemu/hax.h @@ -48,10 +48,8 @@ void hax_cpu_synchronize_post_init(CPUState *cpu); 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); diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index d0d4afcbce..7b4bd46339 100644 --- a/target-i386/hax-all.c +++ b/target-i386/hax-all.c @@ -70,15 +70,12 @@ int hax_vcpu_emulation_mode(CPUState *cpu) 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); @@ -91,7 +88,6 @@ static int hax_prepare_emulation(CPUArchState *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); @@ -147,7 +143,6 @@ int hax_stop_translate(CPUState *cpu) return 0; } -#endif int valid_hax_tunnel_size(uint16_t size) { diff --git a/target-i386/translate.c b/target-i386/translate.c index 58682911e9..701663979c 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7993,15 +7993,12 @@ static inline void gen_intermediate_code_internal(X86CPU *cpu, 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)