summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpu-exec.c2
-rw-r--r--cpus.c15
-rw-r--r--exec.c2
-rw-r--r--hax-stub.c7
-rw-r--r--include/qemu/main-loop.h10
-rw-r--r--include/sysemu/hax.h (renamed from hax.h)8
-rw-r--r--main-loop.c19
-rw-r--r--target-i386/hax-all.c28
-rw-r--r--target-i386/hax-i386.h2
-rw-r--r--target-i386/hax-windows.c2
-rw-r--r--target-i386/translate.c2
-rw-r--r--vl.c2
12 files changed, 45 insertions, 54 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 7d36d963a4..0871c5c04c 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -20,9 +20,9 @@
#include "cpu.h"
#include "disas/disas.h"
#include "tcg.h"
-#include "hax.h"
#include "qemu/atomic.h"
#include "sysemu/qtest.h"
+#include "sysemu/hax.h"
bool qemu_cpu_has_work(CPUState *cpu)
{
diff --git a/cpus.c b/cpus.c
index 3592ba2063..c08a21ba31 100644
--- a/cpus.c
+++ b/cpus.c
@@ -30,7 +30,7 @@
#include "exec/gdbstub.h"
#include "sysemu/dma.h"
#include "sysemu/kvm.h"
-#include "hax.h"
+#include "sysemu/hax.h"
#include "qmp-commands.h"
#include "qemu/thread.h"
@@ -1357,16 +1357,3 @@ void qmp_inject_nmi(Error **errp)
error_set(errp, QERR_UNSUPPORTED);
#endif
}
-
-#ifdef CONFIG_HAX
-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
diff --git a/exec.c b/exec.c
index fb4b7b725a..82c40d6ff6 100644
--- a/exec.c
+++ b/exec.c
@@ -31,7 +31,7 @@
#include "hw/qdev.h"
#include "qemu/osdep.h"
#include "sysemu/kvm.h"
-#include "hax.h"
+#include "sysemu/hax.h"
#include "hw/xen/xen.h"
#include "qemu/timer.h"
#include "qemu/config-file.h"
diff --git a/hax-stub.c b/hax-stub.c
index c939f452fe..456caa8ef7 100644
--- a/hax-stub.c
+++ b/hax-stub.c
@@ -18,7 +18,7 @@
*
*/
-#include "hax.h"
+#include "sysemu/hax.h"
int hax_sync_vcpus(void)
{
@@ -44,8 +44,3 @@ int hax_enabled(void)
{
return 0;
}
-
-void qemu_notify_hax_event(void)
-{
- return;
-}
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index 6014714856..6f0200a7ac 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -101,16 +101,6 @@ AioContext *qemu_get_aio_context(void);
*/
void qemu_notify_event(void);
-// TODO: Mark HAX related code...
-#ifdef CONFIG_HAX_BACKEND
-void qemu_notify_hax_event(void);
-#else
-static inline void qemu_notify_hax_event(void)
-{
-}
-#endif
-//
-
#ifdef _WIN32
/* return TRUE if no sleep should be done afterwards */
typedef int PollingFunc(void *opaque);
diff --git a/hax.h b/include/sysemu/hax.h
index 911898cb62..2def89a5e5 100644
--- a/hax.h
+++ b/include/sysemu/hax.h
@@ -33,10 +33,10 @@ int hax_sync_vcpus(void);
#ifdef CONFIG_HAX
//#include "cpu.h"
-#include "kvm.h"
+//#include "kvm.h"
#include "hw/hw.h"
-#include "bitops.h"
-#include "memory.h"
+#include "qemu/bitops.h"
+#include "exec/memory.h"
int hax_init_vcpu(CPUArchState *env);
int hax_vcpu_exec(CPUArchState *env);
@@ -52,7 +52,7 @@ 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(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);
void hax_reset_vcpu_state(void *opaque);
diff --git a/main-loop.c b/main-loop.c
index 7f81ac3580..b2db5dc865 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -28,6 +28,8 @@
#include "qemu/main-loop.h"
#include "block/aio.h"
+#include "sysemu/hax.h"
+
#ifndef _WIN32
#include "qemu/compatfd.h"
@@ -114,14 +116,27 @@ 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;
}
- // TODO: Mark HAX related code...
+#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 a939f1d66f..7ef9063c99 100644
--- a/target-i386/hax-all.c
+++ b/target-i386/hax-all.c
@@ -279,15 +279,16 @@ int hax_vcpu_destroy(CPUArchState *env)
int hax_init_vcpu(CPUArchState *env)
{
int ret;
+ CPUState *cpu = ENV_GET_CPU(env);
- ret = hax_vcpu_create(env->cpu_index);
+ ret = hax_vcpu_create(cpu->cpu_index);
if (ret < 0)
{
dprint("Failed to create HAX vcpu\n");
exit(-1);
}
- env->hax_vcpu = hax_global.vm->vcpus[env->cpu_index];
+ env->hax_vcpu = hax_global.vm->vcpus[cpu->cpu_index];
env->hax_vcpu->emulation_state = HAX_EMULATE_STATE_INITIAL;
env->hax_vcpu_dirty = 1;
qemu_register_reset(hax_reset_vcpu_state, env);
@@ -431,7 +432,8 @@ static MemoryListener hax_memory_listener = {
static void hax_handle_interrupt(CPUArchState *env, int mask)
{
- env->interrupt_request |= mask;
+ CPUState *cpu = ENV_GET_CPU(env);
+ cpu->interrupt_request |= mask;
if (!qemu_cpu_is_self(env)) {
qemu_cpu_kick(env);
@@ -578,17 +580,18 @@ static int hax_vcpu_interrupt(CPUArchState *env)
{
struct hax_vcpu_state *vcpu = env->hax_vcpu;
struct hax_tunnel *ht = vcpu->tunnel;
+ CPUState *cpu = ENV_GET_CPU(env);
/*
* Try to inject an interrupt if the guest can accept it
* Unlike KVM, HAX kernel check for the eflags, instead of qemu
*/
if (ht->ready_for_interrupt_injection &&
- (env->interrupt_request & CPU_INTERRUPT_HARD))
+ (cpu->interrupt_request & CPU_INTERRUPT_HARD))
{
int irq;
- env->interrupt_request &= ~CPU_INTERRUPT_HARD;
+ cpu->interrupt_request &= ~CPU_INTERRUPT_HARD;
irq = cpu_get_pic_interrupt(env);
if (irq >= 0) {
hax_inject_interrupt(env, irq);
@@ -599,7 +602,7 @@ static int hax_vcpu_interrupt(CPUArchState *env)
* interrupt, request an interrupt window exit. This will
* cause a return to userspace as soon as the guest is ready to
* receive interrupts. */
- if ((env->interrupt_request & CPU_INTERRUPT_HARD))
+ if ((cpu->interrupt_request & CPU_INTERRUPT_HARD))
ht->request_interrupt_window = 1;
else
ht->request_interrupt_window = 0;
@@ -630,6 +633,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
int ret = 0;
struct hax_vcpu_state *vcpu = env->hax_vcpu;
struct hax_tunnel *ht = vcpu->tunnel;
+ CPUState *cpu = ENV_GET_CPU(env);
if (hax_vcpu_emulation_mode(env))
{
@@ -644,7 +648,7 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
int hax_ret;
- if (env->exit_request) {
+ if (cpu->exit_request) {
ret = HAX_EMUL_EXITLOOP ;
break;
}
@@ -702,11 +706,11 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
ret = HAX_EMUL_EXITLOOP;
break;
case HAX_EXIT_HLT:
- if (!(env->interrupt_request & CPU_INTERRUPT_HARD) &&
- !(env->interrupt_request & CPU_INTERRUPT_NMI)) {
+ if (!(cpu->interrupt_request & CPU_INTERRUPT_HARD) &&
+ !(cpu->interrupt_request & CPU_INTERRUPT_NMI)) {
/* hlt instruction with interrupt disabled is shutdown */
env->eflags |= IF_MASK;
- env->halted = 1;
+ cpu->halted = 1;
env->exception_index = EXCP_HLT;
ret = HAX_EMUL_HLT;
}
@@ -725,8 +729,8 @@ static int hax_vcpu_hax_exec(CPUArchState *env)
}
}while (!ret);
- if (env->exit_request) {
- env->exit_request = 0;
+ if (cpu->exit_request) {
+ cpu->exit_request = 0;
env->exception_index = EXCP_INTERRUPT;
}
return ret;
diff --git a/target-i386/hax-i386.h b/target-i386/hax-i386.h
index ac69e956b9..655e8bd47a 100644
--- a/target-i386/hax-i386.h
+++ b/target-i386/hax-i386.h
@@ -13,7 +13,7 @@
#define _HAX_I386_H
//#include "android/utils/debug.h"
-#include "hax.h"
+#include "sysemu/hax.h"
#ifdef CONFIG_DARWIN
typedef int hax_fd;
diff --git a/target-i386/hax-windows.c b/target-i386/hax-windows.c
index 0c8e261253..8312cd2a96 100644
--- a/target-i386/hax-windows.c
+++ b/target-i386/hax-windows.c
@@ -101,7 +101,7 @@ int hax_set_phys_mem(MemoryRegionSection *section)
{
struct hax_set_ram_info info, *pinfo = &info;
MemoryRegion *mr = section->mr;
- target_phys_addr_t start_addr = section->offset_within_address_space;
+ hwaddr start_addr = section->offset_within_address_space;
ram_addr_t size = section->size;
HANDLE hDeviceVM;
DWORD dSize = 0;
diff --git a/target-i386/translate.c b/target-i386/translate.c
index f165937a37..2215a460ed 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -31,7 +31,7 @@
#include "helper.h"
#define GEN_HELPER 1
#include "helper.h"
-#include "hax.h"
+#include "sysemu/hax.h"
#define PREFIX_REPZ 0x01
#define PREFIX_REPNZ 0x02
diff --git a/vl.c b/vl.c
index 0adbdd1022..2f39c0d2c8 100644
--- a/vl.c
+++ b/vl.c
@@ -154,7 +154,7 @@ int qemu_main(int argc, char **argv, char **envp);
#include "audio/audio.h"
#include "migration/migration.h"
#include "sysemu/kvm.h"
-#include "hax.h"
+#include "sysemu/hax.h"
#include "qapi/qmp/qjson.h"
#include "qemu/option.h"
#include "qemu/config-file.h"