#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)
{
#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"
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
#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"
*
*/
-#include "hax.h"
+#include "sysemu/hax.h"
int hax_sync_vcpus(void)
{
{
return 0;
}
-
-void qemu_notify_hax_event(void)
-{
- return;
-}
+++ /dev/null
-/*
- * QEMU HAXM support
- *
- * Copyright IBM, Corp. 2008
- *
- * Authors:
- * Anthony Liguori <aliguori@us.ibm.com>
- *
- * Copyright (c) 2011 Intel Corporation
- * Written by:
- * Jiang Yunhong<yunhong.jiang@intel.com>
- * Xin Xiaohui<xiaohui.xin@intel.com>
- * Zhang Xiantao<xiantao.zhang@intel.com>
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- *
- */
-
-/* header to be included in non-HAX-specific code */
-#ifndef _HAX_H
-#define _HAX_H
-
-#include "config-host.h"
-#include "qemu-common.h"
-
-#define dprint printf
-#ifdef CONFIG_HAX_BACKEND
-int hax_enabled(void);
-void hax_disable(int disable);
-int hax_pre_init(uint64_t ram_size);
-int hax_accel_init(void);
-int hax_sync_vcpus(void);
-
-#ifdef CONFIG_HAX
-//#include "cpu.h"
-#include "kvm.h"
-#include "hw/hw.h"
-#include "bitops.h"
-#include "memory.h"
-
-int hax_init_vcpu(CPUArchState *env);
-int hax_vcpu_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_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(CPUArchState *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);
-#include "target-i386/hax-interface.h"
-#include "target-i386/hax-i386.h"
-#endif
-
-#else
-
-#define hax_enabled() (0)
-#define hax_sync_vcpus()
-#define hax_accel_init() (0)
-#define hax_pre_init(x)
-
-#endif
-
-#endif
*/
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);
--- /dev/null
+/*
+ * QEMU HAXM support
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * Copyright (c) 2011 Intel Corporation
+ * Written by:
+ * Jiang Yunhong<yunhong.jiang@intel.com>
+ * Xin Xiaohui<xiaohui.xin@intel.com>
+ * Zhang Xiantao<xiantao.zhang@intel.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ *
+ */
+
+/* header to be included in non-HAX-specific code */
+#ifndef _HAX_H
+#define _HAX_H
+
+#include "config-host.h"
+#include "qemu-common.h"
+
+#define dprint printf
+#ifdef CONFIG_HAX_BACKEND
+int hax_enabled(void);
+void hax_disable(int disable);
+int hax_pre_init(uint64_t ram_size);
+int hax_accel_init(void);
+int hax_sync_vcpus(void);
+
+#ifdef CONFIG_HAX
+//#include "cpu.h"
+//#include "kvm.h"
+#include "hw/hw.h"
+#include "qemu/bitops.h"
+#include "exec/memory.h"
+
+int hax_init_vcpu(CPUArchState *env);
+int hax_vcpu_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_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);
+void hax_reset_vcpu_state(void *opaque);
+#include "target-i386/hax-interface.h"
+#include "target-i386/hax-i386.h"
+#endif
+
+#else
+
+#define hax_enabled() (0)
+#define hax_sync_vcpus()
+#define hax_accel_init() (0)
+#define hax_pre_init(x)
+
+#endif
+
+#endif
#include "qemu/main-loop.h"
#include "block/aio.h"
+#include "sysemu/hax.h"
+
#ifndef _WIN32
#include "qemu/compatfd.h"
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);
}
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);
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);
{
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);
* 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;
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))
{
int hax_ret;
- if (env->exit_request) {
+ if (cpu->exit_request) {
ret = HAX_EMUL_EXITLOOP ;
break;
}
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;
}
}
}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;
#define _HAX_I386_H
//#include "android/utils/debug.h"
-#include "hax.h"
+#include "sysemu/hax.h"
#ifdef CONFIG_DARWIN
typedef int hax_fd;
{
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;
#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
#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"