hax: for testing...
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 7 Nov 2014 02:40:37 +0000 (11:40 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 7 Nov 2014 02:40:37 +0000 (11:40 +0900)
Change-Id: Ia5f03db254b576e0f3847df52f9e4fde2f9c65b7
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
cpu-exec.c
cpus.c
include/sysemu/hax.h
target-i386/hax-all.c
target-i386/translate.c

index 64a6150..c3d4b7b 100644 (file)
@@ -214,26 +214,17 @@ 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)))
@@ -331,11 +322,6 @@ 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);
@@ -380,10 +366,6 @@ 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) &&
@@ -709,10 +691,6 @@ 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 b28a92a..226dbc4 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1182,10 +1182,6 @@ 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);
index 3b67838..a2c6da4 100644 (file)
@@ -48,8 +48,10 @@ 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);
index 7b4bd46..d0d4afc 100644 (file)
@@ -70,12 +70,15 @@ int hax_vcpu_emulation_mode(CPUState *cpu)
 
     if (hax_enabled())
         return 0;
-    else
+    else {
+        assert(0);
         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);
@@ -88,6 +91,7 @@ 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);
@@ -143,6 +147,7 @@ int hax_stop_translate(CPUState *cpu)
 
     return 0;
 }
+#endif
 
 int valid_hax_tunnel_size(uint16_t size)
 {
index 7016639..5868291 100644 (file)
@@ -7993,12 +7993,15 @@ 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)