From d9ef78b5f17db3ab61e2770a2e34c4639672a72b Mon Sep 17 00:00:00 2001 From: yucheng yu Date: Mon, 29 Sep 2014 17:18:27 -0700 Subject: [PATCH] hax: clean up Changed Haxm global function interface from CPUArchState to CPUState. Removed Haxm code from kvm.h and cpu.h. Removed CONFIG_HAX_BACKEND. Additional modification: Fixed Compilation error on linux. Removed warnings. Using "hax-stub.c" if CONFIG_HAX is not defined. Change-Id: I52ab99f1650bdd81b6c0efa61e4f9f3c4d766512 Signed-off-by: Yucheng Yu Signed-off-by: SeokYeon Hwang --- Makefile.target | 3 +-- configure | 9 ------- cpu-exec.c | 7 +++-- cpus.c | 24 ++++++++++++++--- exec.c | 2 +- hw/acpi/ich9.c | 3 ++- hw/acpi/piix4.c | 3 ++- include/sysemu/hax.h | 49 +++++++++++++--------------------- include/sysemu/kvm.h | 12 --------- main-loop.c | 16 ----------- target-i386/hax-all.c | 68 ++++++++++++++++++++++++++--------------------- target-i386/hax-darwin.c | 6 ++--- target-i386/hax-windows.c | 6 ++--- target-i386/translate.c | 2 +- vl.c | 5 ---- 15 files changed, 91 insertions(+), 124 deletions(-) diff --git a/Makefile.target b/Makefile.target index 3f21496..a1e78ef 100644 --- a/Makefile.target +++ b/Makefile.target @@ -126,12 +126,11 @@ obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o # HAX support ifdef CONFIG_WIN32 obj-$(CONFIG_HAX) += target-i386/hax-all.o target-i386/hax-windows.o -obj-$(CONFIG_NO_HAX) += hax-stub.o endif ifdef CONFIG_DARWIN obj-$(CONFIG_HAX) += target-i386/hax-all.o target-i386/hax-darwin.o -obj-$(CONFIG_NO_HAX) += hax-stub.o endif +obj-$(call lnot,$(CONFIG_HAX)) += hax-stub.o # Hardware support ifeq ($(TARGET_NAME), sparc64) diff --git a/configure b/configure index 20ab947..0bd585f 100755 --- a/configure +++ b/configure @@ -4887,15 +4887,6 @@ echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak if test "$trace_default" = "yes"; then echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak fi -if test "$hax" = "yes" ; then - if test "$mingw32" = "yes" ; then - echo "CONFIG_HAX_BACKEND=y" >> $config_host_mak - elif test "$darwin" = "yes" ; then - echo "CONFIG_HAX_BACKEND=y" >> $config_host_mak - else - hax="no" - fi -fi if test "$rdma" = "yes" ; then echo "CONFIG_RDMA=y" >> $config_host_mak diff --git a/cpu-exec.c b/cpu-exec.c index c07c8af..64a6150 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -223,8 +223,7 @@ volatile sig_atomic_t exit_request; static int need_handle_intr_request(CPUState *cpu) { #ifdef CONFIG_HAX - CPUArchState *env = cpu->env_ptr; - if (!hax_enabled() || hax_vcpu_emulation_mode(env)) + if (!hax_enabled() || hax_vcpu_emulation_mode(cpu)) return cpu->interrupt_request; return 0; #else @@ -333,7 +332,7 @@ int cpu_exec(CPUArchState *env) } #ifdef CONFIG_HAX - if (hax_enabled() && !hax_vcpu_exec(env)) + if (hax_enabled() && !hax_vcpu_exec(cpu)) longjmp(cpu->jmp_env, 1); #endif @@ -711,7 +710,7 @@ int cpu_exec(CPUArchState *env) } cpu->current_tb = NULL; #ifdef CONFIG_HAX - if (hax_enabled() && hax_stop_emulation(env)) + if (hax_enabled() && hax_stop_emulation(cpu)) cpu_loop_exit(cpu); #endif /* reset soft MMU for next block (it can currently diff --git a/cpus.c b/cpus.c index 24b72c8..9c96c8d 100644 --- a/cpus.c +++ b/cpus.c @@ -511,6 +511,10 @@ void cpu_synchronize_all_post_reset(void) CPU_FOREACH(cpu) { cpu_synchronize_post_reset(cpu); +#ifdef CONFIG_HAX + if (hax_enabled()) + hax_cpu_synchronize_post_reset(cpu); +#endif } } @@ -520,6 +524,10 @@ void cpu_synchronize_all_post_init(void) CPU_FOREACH(cpu) { cpu_synchronize_post_init(cpu); +#ifdef CONFIG_HAX + if (hax_enabled()) + hax_cpu_synchronize_post_init(cpu); +#endif } } @@ -837,6 +845,7 @@ static void qemu_tcg_wait_io_event(void) } } +#ifdef CONFIG_HAX static void qemu_hax_wait_io_event(CPUState *cpu) { while (cpu_thread_is_idle(cpu)) { @@ -845,6 +854,7 @@ static void qemu_hax_wait_io_event(CPUState *cpu) qemu_wait_io_event_common(cpu); } +#endif static void qemu_kvm_wait_io_event(CPUState *cpu) { @@ -975,6 +985,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) return NULL; } +#ifdef CONFIG_HAX static void *qemu_hax_cpu_thread_fn(void *arg) { CPUState *cpu = arg; @@ -987,12 +998,12 @@ static void *qemu_hax_cpu_thread_fn(void *arg) cpu->created = true; current_cpu = cpu; - hax_init_vcpu(cpu->env_ptr); + hax_init_vcpu(cpu); qemu_cond_signal(&qemu_cpu_cond); while (1) { if (cpu_can_run(cpu)) { - r = hax_smp_cpu_exec(cpu->env_ptr); + r = hax_smp_cpu_exec(cpu); if (r == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); } @@ -1001,6 +1012,7 @@ static void *qemu_hax_cpu_thread_fn(void *arg) } return NULL; } +#endif static void qemu_cpu_kick_thread(CPUState *cpu) { @@ -1170,8 +1182,8 @@ void resume_all_vcpus(void) static void qemu_tcg_init_vcpu(CPUState *cpu) { #ifdef CONFIG_HAX - if (hax_enabled()) - hax_init_vcpu(cpu->env_ptr); + if (hax_enabled()) + hax_init_vcpu(cpu); #endif char thread_name[VCPU_THREAD_NAME_SIZE]; @@ -1200,6 +1212,7 @@ static void qemu_tcg_init_vcpu(CPUState *cpu) } } +#ifdef CONFIG_HAX static void qemu_hax_start_vcpu(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; @@ -1220,6 +1233,7 @@ static void qemu_hax_start_vcpu(CPUState *cpu) qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); } } +#endif static void qemu_kvm_start_vcpu(CPUState *cpu) { @@ -1260,8 +1274,10 @@ void qemu_init_vcpu(CPUState *cpu) cpu->stopped = true; if (kvm_enabled()) { qemu_kvm_start_vcpu(cpu); +#ifdef CONFIG_HAX } else if (hax_enabled()) { qemu_hax_start_vcpu(cpu); +#endif } else if (tcg_enabled()) { qemu_tcg_init_vcpu(cpu); } else { diff --git a/exec.c b/exec.c index 346a196..2c26903 100644 --- a/exec.c +++ b/exec.c @@ -1297,7 +1297,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, */ if (hax_enabled()) { int ret; - ret = hax_populate_ram((uint64_t)new_block->host, size); + ret = hax_populate_ram((uint64_t)(uintptr_t)new_block->host, size); if (ret < 0) { fprintf(stderr, "Hax failed to populate ram\n"); exit(-1); diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 6d5f226..8e4e972 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -31,6 +31,7 @@ #include "sysemu/sysemu.h" #include "hw/acpi/acpi.h" #include "sysemu/kvm.h" +#include "sysemu/hax.h" #include "exec/address-spaces.h" #include "hw/i386/ich9.h" @@ -158,7 +159,7 @@ const VMStateDescription vmstate_ich9_pm = { VMSTATE_END_OF_LIST() } }; -extern int hax_enabled(void); + static void pm_reset(void *opaque) { ICH9LPCPMRegs *pm = opaque; diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index cc92e26..9bfea6c 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -25,6 +25,7 @@ #include "hw/pci/pci.h" #include "hw/acpi/acpi.h" #include "sysemu/sysemu.h" +#include "sysemu/hax.h" #include "qemu/range.h" #include "exec/ioport.h" #include "hw/nvram/fw_cfg.h" @@ -283,7 +284,7 @@ static const VMStateDescription vmstate_acpi = { VMSTATE_END_OF_LIST() } }; -extern int hax_enabled(void); + static void piix4_reset(void *opaque) { PIIX4PMState *s = opaque; diff --git a/include/sysemu/hax.h b/include/sysemu/hax.h index 1917a2b..3b67838 100644 --- a/include/sysemu/hax.h +++ b/include/sysemu/hax.h @@ -23,8 +23,10 @@ #include "config-host.h" #include "qemu-common.h" -#define dprint printf -#ifdef CONFIG_HAX_BACKEND + +// This needs to be fixed for vl.c, ich9.c, piix4.c. +// Those files do not include config.h and will not have CONFIG_HAX defined. + int hax_enabled(void); void hax_disable(int disable); int hax_pre_init(uint64_t ram_size); @@ -32,43 +34,28 @@ int hax_accel_init(void); int hax_sync_vcpus(void); #ifdef CONFIG_HAX -//#include "cpu.h" -//#include "kvm.h" + +#define dprint printf + #include "hw/hw.h" #include "qemu/bitops.h" #include "exec/memory.h" - -int hax_init_vcpu(CPUArchState *env); -int hax_vcpu_exec(CPUArchState *env); -int hax_smp_cpu_exec(CPUArchState *env); -void hax_vcpu_sync_state(CPUArchState *env, int modified); -//extern void hax_cpu_synchronize_state(CPUArchState *env); -//extern void hax_cpu_synchronize_post_reset(CPUArchState *env); -//extern void hax_cpu_synchronize_post_init(CPUArchState *env); +int hax_init_vcpu(CPUState *cpu); +int hax_vcpu_exec(CPUState *cpu); +int hax_smp_cpu_exec(CPUState *cpu); +void hax_cpu_synchronize_post_reset(CPUState *cpu); +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(CPUArchState *env); -int hax_stop_emulation(CPUArchState *env); -int hax_stop_translate(CPUArchState *env); -int hax_arch_get_registers(CPUArchState *env); -int hax_vcpu_destroy(CPUArchState *env); -void hax_raise_event(CPUArchState *env); -//int need_handle_intr_request(CPUState *env); -int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int direction, - int size, int count, void *buffer); +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); #include "target-i386/hax-interface.h" #include "target-i386/hax-i386.h" -int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft); -#endif - -#else - -#define hax_enabled() (0) -#define hax_sync_vcpus() -#define hax_accel_init() (0) -#define hax_pre_init(x) #endif -#endif +#endif // _HAX_H diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index cdfa911..0bee1e8 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -307,10 +307,6 @@ int kvm_physical_memory_addr_from_host(KVMState *s, void *ram_addr, void kvm_cpu_synchronize_state(CPUState *cpu); void kvm_cpu_synchronize_post_reset(CPUState *cpu); void kvm_cpu_synchronize_post_init(CPUState *cpu); -#ifdef CONFIG_HAX -void hax_cpu_synchronize_post_reset(CPUArchState *env); -void hax_cpu_synchronize_post_init(CPUArchState *env); -#endif /* generic hooks - to be moved/refactored once there are more users */ @@ -326,10 +322,6 @@ static inline void cpu_synchronize_post_reset(CPUState *cpu) if (kvm_enabled()) { kvm_cpu_synchronize_post_reset(cpu); } -#ifdef CONFIG_HAX - CPUArchState *env = cpu->env_ptr; - hax_cpu_synchronize_post_reset(env); -#endif } static inline void cpu_synchronize_post_init(CPUState *cpu) @@ -337,10 +329,6 @@ static inline void cpu_synchronize_post_init(CPUState *cpu) if (kvm_enabled()) { kvm_cpu_synchronize_post_init(cpu); } -#ifdef CONFIG_HAX - CPUArchState *env = cpu->env_ptr; - hax_cpu_synchronize_post_init(env); -#endif } int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg); diff --git a/main-loop.c b/main-loop.c index 13e52a0..054a559 100644 --- a/main-loop.c +++ b/main-loop.c @@ -118,27 +118,11 @@ AioContext *qemu_get_aio_context(void) return qemu_aio_context; } -#ifdef CONFIG_HAX -static void qemu_notify_hax_event(void) -{ - CPUArchState *env = NULL; - - if (hax_enabled()) { - for (env = first_cpu; env != NULL; env = env->next_cpu) { - hax_raise_event(env); - } - } -} -#endif - void qemu_notify_event(void) { if (!qemu_aio_context) { return; } -#ifdef CONFIG_HAX - qemu_notify_hax_event(); -#endif aio_notify(qemu_aio_context); } diff --git a/target-i386/hax-all.c b/target-i386/hax-all.c index b3d47a7..d8ed4ed 100644 --- a/target-i386/hax-all.c +++ b/target-i386/hax-all.c @@ -40,6 +40,11 @@ #define HAX_EMULATE_STATE_NONE 0x3 #define HAX_EMULATE_STATE_INITIAL 0x4 +static void hax_vcpu_sync_state(CPUArchState *env, int modified); +static int hax_arch_get_registers(CPUArchState *env); +static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int dir, int size, int cnt, void *buf); +static int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft); + struct hax_state hax_global; int ret_hax_init = 0; static int hax_disabled = 1; @@ -58,7 +63,7 @@ void hax_disable(int disable) } /* Currently non-PG modes are emulated by QEMU */ -int hax_vcpu_emulation_mode(CPUArchState *env) +int hax_vcpu_emulation_mode(CPUState *cpu) { // Tcg is single-thread, so we need haxm to run smp. // If the host has no UG, we always run tcg. @@ -98,7 +103,7 @@ static int hax_stop_tbloop(CPUArchState *env) break; case HAX_EMULATE_STATE_INITIAL: case HAX_EMULATE_STATE_REAL: - if (!hax_vcpu_emulation_mode(env)) + if (!hax_vcpu_emulation_mode(cpu)) return 1; break; default: @@ -110,9 +115,10 @@ static int hax_stop_tbloop(CPUArchState *env) return 0; } -int hax_stop_emulation(CPUArchState *env) +int hax_stop_emulation(CPUState *cpu) { - CPUState *cpu = ENV_GET_CPU(env); + CPUArchState *env = (CPUArchState *)(cpu->env_ptr); + if (hax_stop_tbloop(env)) { cpu->hax_vcpu->emulation_state = HAX_EMULATE_STATE_NONE; @@ -127,11 +133,10 @@ int hax_stop_emulation(CPUArchState *env) return 0; } -int hax_stop_translate(CPUArchState *env) +int hax_stop_translate(CPUState *cpu) { - struct hax_vcpu_state *vstate; + struct hax_vcpu_state *vstate = cpu->hax_vcpu; - vstate = ENV_GET_CPU(env)->hax_vcpu; assert(vstate->emulation_state); if (vstate->emulation_state == HAX_EMULATE_STATE_MMIO ) return 1; @@ -272,9 +277,9 @@ error: return -1; } -int hax_vcpu_destroy(CPUArchState *env) +int hax_vcpu_destroy(CPUState *cpu) { - struct hax_vcpu_state *vcpu = ENV_GET_CPU(env)->hax_vcpu; + struct hax_vcpu_state *vcpu = cpu->hax_vcpu; if (!hax_global.vm) { @@ -295,10 +300,9 @@ int hax_vcpu_destroy(CPUArchState *env) return 0; } -int hax_init_vcpu(CPUArchState *env) +int hax_init_vcpu(CPUState *cpu) { int ret; - CPUState *cpu = ENV_GET_CPU(env); ret = hax_vcpu_create(cpu->cpu_index); if (ret < 0) @@ -310,7 +314,7 @@ int hax_init_vcpu(CPUArchState *env) cpu->hax_vcpu = hax_global.vm->vcpus[cpu->cpu_index]; cpu->hax_vcpu->emulation_state = HAX_EMULATE_STATE_INITIAL; cpu->hax_vcpu_dirty = 1; - qemu_register_reset(hax_reset_vcpu_state, env); + qemu_register_reset(hax_reset_vcpu_state, (CPUArchState *)(cpu->env_ptr)); return ret; } @@ -556,7 +560,7 @@ int hax_accel_init(void) } } -int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft) +static int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft) { uint64_t buf = 0; /* @@ -581,7 +585,7 @@ int hax_handle_fastmmio(CPUArchState *env, struct hax_fastmmio *hft) return 0; } -int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int direction, +static int hax_handle_io(CPUArchState *env, uint32_t df, uint16_t port, int direction, int size, int count, void *buffer) { uint8_t *ptr; @@ -660,9 +664,9 @@ static int hax_vcpu_interrupt(CPUArchState *env) return 0; } -void hax_raise_event(CPUArchState *env) +void hax_raise_event(CPUState *cpu) { - struct hax_vcpu_state *vcpu = ENV_GET_CPU(env)->hax_vcpu; + struct hax_vcpu_state *vcpu = cpu->hax_vcpu; if (!vcpu) return; @@ -687,7 +691,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) struct hax_vcpu_state *vcpu = cpu->hax_vcpu; struct hax_tunnel *ht = vcpu->tunnel; - if (hax_vcpu_emulation_mode(env)) + if (hax_vcpu_emulation_mode(cpu)) { dprint("Trying to vcpu execute at eip:%lx\n", env->eip); return HAX_EMUL_EXITLOOP; @@ -705,7 +709,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env) hax_vcpu_sync_state(env, 1); } - //hax_cpu_synchronize_state(env); + //hax_cpu_synchronize_state(cpu); do { int hax_ret; @@ -716,9 +720,9 @@ static int hax_vcpu_hax_exec(CPUArchState *env) } #if 0 - if (env->hax_vcpu_dirty) { + if (cpu->hax_vcpu_dirty) { hax_vcpu_sync_state(env, 1); - env->hax_vcpu_dirty = 0; + cpu->hax_vcpu_dirty = 0; } #endif @@ -817,7 +821,7 @@ static void do_hax_cpu_synchronize_state(void *_env) } } -void hax_cpu_synchronize_state(CPUState *cpu) +static void hax_cpu_synchronize_state(CPUState *cpu) { if (!cpu->hax_vcpu_dirty) { run_on_cpu(cpu, do_hax_cpu_synchronize_state, cpu); @@ -825,26 +829,28 @@ void hax_cpu_synchronize_state(CPUState *cpu) } #endif -void hax_cpu_synchronize_post_reset(CPUArchState *env) +void hax_cpu_synchronize_post_reset(CPUState *cpu) { + CPUArchState *env = (CPUArchState *)(cpu->env_ptr); hax_vcpu_sync_state(env, 1); - ENV_GET_CPU(env)->hax_vcpu_dirty = 0; + cpu->hax_vcpu_dirty = 0; } -void hax_cpu_synchronize_post_init(CPUArchState *env) +void hax_cpu_synchronize_post_init(CPUState *cpu) { + CPUArchState *env = (CPUArchState *)(cpu->env_ptr); hax_vcpu_sync_state(env, 1); - ENV_GET_CPU(env)->hax_vcpu_dirty = 0; + cpu->hax_vcpu_dirty = 0; } /* * return 1 when need emulate, 0 when need exit loop */ -int hax_vcpu_exec(CPUArchState *env) +int hax_vcpu_exec(CPUState *cpu) { int next = 0, ret = 0; struct hax_vcpu_state *vcpu; - CPUState *cpu = ENV_GET_CPU(env); + CPUArchState *env = (CPUArchState *)(cpu->env_ptr); if (cpu->hax_vcpu->emulation_state != HAX_EMULATE_STATE_NONE) return 1; @@ -875,9 +881,9 @@ int hax_vcpu_exec(CPUArchState *env) return ret; } -int hax_smp_cpu_exec(CPUArchState *env) +int hax_smp_cpu_exec(CPUState *cpu) { - CPUState *cpu = ENV_GET_CPU(env); + CPUArchState *env = (CPUArchState *)(cpu->env_ptr); int why; int ret; @@ -1226,7 +1232,7 @@ static int hax_set_fpu(CPUArchState *env) return hax_sync_fpu(env, &fpu, 1); } -int hax_arch_get_registers(CPUArchState *env) +static int hax_arch_get_registers(CPUArchState *env) { int ret; @@ -1271,7 +1277,7 @@ static int hax_arch_set_registers(CPUArchState *env) return 0; } -void hax_vcpu_sync_state(CPUArchState *env, int modified) +static void hax_vcpu_sync_state(CPUArchState *env, int modified) { if (hax_enabled()) { if (modified) diff --git a/target-i386/hax-darwin.c b/target-i386/hax-darwin.c index 7b9b8db..b8dcbd4 100644 --- a/target-i386/hax-darwin.c +++ b/target-i386/hax-darwin.c @@ -84,7 +84,7 @@ int hax_set_phys_mem(MemoryRegionSection *section) info.pa_start = start_addr; info.size = size; - info.va = (uint64_t)(memory_region_get_ram_ptr(mr) + section->offset_within_region); + info.va = (uint64_t)(intptr_t)(memory_region_get_ram_ptr(mr) + section->offset_within_region); info.flags = memory_region_is_rom(mr) ? 1 : 0; ret = ioctl(hax_global.vm->fd, HAX_VM_IOCTL_SET_RAM, pinfo); @@ -264,8 +264,8 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) return ret; } - vcpu->tunnel = (struct hax_tunnel *)(info.va); - vcpu->iobuf = (unsigned char *)(info.io_va); + vcpu->tunnel = (struct hax_tunnel *)(intptr_t)(info.va); + vcpu->iobuf = (unsigned char *)(intptr_t)(info.io_va); return 0; } diff --git a/target-i386/hax-windows.c b/target-i386/hax-windows.c index 1538db9..ae2ea2e 100644 --- a/target-i386/hax-windows.c +++ b/target-i386/hax-windows.c @@ -121,7 +121,7 @@ int hax_set_phys_mem(MemoryRegionSection *section) info.pa_start = start_addr; info.size = size; - info.va = (uint64_t)(memory_region_get_ram_ptr(mr) + + info.va = (uint64_t)(intptr_t)(memory_region_get_ram_ptr(mr) + section->offset_within_region); info.flags = memory_region_is_rom(mr) ? 1 : 0; @@ -377,8 +377,8 @@ int hax_host_setup_vcpu_channel(struct hax_vcpu_state *vcpu) ret = -EINVAL; return ret; } - vcpu->tunnel = (struct hax_tunnel *)(info.va); - vcpu->iobuf = (unsigned char *)(info.io_va); + vcpu->tunnel = (struct hax_tunnel *)(intptr_t)(info.va); + vcpu->iobuf = (unsigned char *)(intptr_t)(info.io_va); return 0; } diff --git a/target-i386/translate.c b/target-i386/translate.c index 9cc8922..7016639 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -7993,7 +7993,7 @@ static inline void gen_intermediate_code_internal(X86CPU *cpu, pc_ptr = disas_insn(env, dc, pc_ptr); num_insns++; #ifdef CONFIG_HAX - if (hax_enabled() && hax_stop_translate(env)) + if (hax_enabled() && hax_stop_translate(cs)) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); diff --git a/vl.c b/vl.c index 73495ee..1ee1819 100644 --- a/vl.c +++ b/vl.c @@ -3970,15 +3970,10 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_enable_hax: -#ifdef CONFIG_HAX_BACKEND olist = qemu_find_opts("machine"); //qemu_opts_reset(olist); hax_disable(0); //qemu_opts_parse(olist, "accel=hax", 0); -#else - fprintf(stderr, - "HAX support is disabled, ignoring -enable-hax\n"); -#endif break; case QEMU_OPTION_add_fd: #ifndef _WIN32 -- 2.7.4