From 8fdd165fa910de700649f05f2b074a21e18500d4 Mon Sep 17 00:00:00 2001
authorXin Xiaohui <xiaohui.xin@intel.com>
Tue, 8 Jan 2013 03:21:56 +0000 (11:21 +0800)
committerZhai Edwin <edwin.zhai@intel.com>
Tue, 8 Jan 2013 05:23:13 +0000 (13:23 +0800)
Subject: [PATCH] Re-add qemu_notify_hax_event()

Signed-off-by: Xin Xiaohui <xiaohui.xin@intel.com>
Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Makefile
cpus.c
hax-stub.c
hax.h
main-loop.c
main-loop.h
target-i386/hax-all.c

index c11a5279e99343abe6796d839a5cadef16735965..602615a5c06d85cd5b66d7c21bdb780328ba0273 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -156,6 +156,7 @@ tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \
        qemu-timer-common.o main-loop.o notify.o \
        iohandler.o cutils.o iov.o async.o
 tools-obj-$(CONFIG_POSIX) += compatfd.o
+tools-obj-$(CONFIG_HAX_BACKEND) += hax-stub.o
 
 qemu-img$(EXESUF): qemu-img.o $(tools-obj-y) $(block-obj-y)
 qemu-nbd$(EXESUF): qemu-nbd.o $(tools-obj-y) $(block-obj-y)
diff --git a/cpus.c b/cpus.c
index 4659db41a4823977caf446567923cae868d303c7..82d82396eb7640cea4c9c59951a40a2502ce88e3 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -1349,12 +1349,15 @@ void qmp_inject_nmi(Error **errp)
 #endif
 }
 
-#ifdef  CONFIG_HAX
+#ifdef CONFIG_HAX
 void qemu_notify_hax_event(void)
 {
-       CPUArchState *env = cpu_single_env;
+   CPUArchState *env = NULL;
 
-       if (hax_enabled() && env)
-               hax_raise_event(env);
+   if (hax_enabled()) {
+       for (env = first_cpu; env != NULL; env = env->next_cpu) {
+           hax_raise_event(env);
+       }
+   }
 }
 #endif
index 9e200a07b2510298ecb64566d80a940619d4d8a9..c939f452fe6047f530930bb1b33f5460754f76a4 100644 (file)
@@ -35,7 +35,7 @@ void hax_disable(int disable)
    return;
 }
 
-int hax_pre_init(ram_addr_t ram_size)
+int hax_pre_init(uint64_t ram_size)
 {
    return 0;
 }
diff --git a/hax.h b/hax.h
index 0e782aca95ba20e87bbee1e502794d6b288220ec..911898cb6278608ce71bb82be0b06003d53f8110 100644 (file)
--- a/hax.h
+++ b/hax.h
 
 #include "config-host.h"
 #include "qemu-common.h"
-//#include "cpu.h"
-#include "kvm.h"
-#include "hw/hw.h"
-#include "bitops.h"
-#include "memory.h"
 
 #define dprint printf
 #ifdef CONFIG_HAX_BACKEND
 int hax_enabled(void);
 void hax_disable(int disable);
-int hax_pre_init(ram_addr_t ram_size);
+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);
@@ -53,16 +55,18 @@ 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 qemu_notify_hax_event(void);
 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
index 907f3670c205bcee1ffcea9705738e739c422970..b09a82ab6714b0d100e564244c7d0c64dc2f6680 100644 (file)
@@ -42,6 +42,9 @@ void qemu_notify_event(void)
     if (io_thread_fd == -1) {
         return;
     }
+
+    qemu_notify_hax_event();
+
     do {
         ret = write(io_thread_fd, &val, sizeof(val));
     } while (ret < 0 && errno == EINTR);
@@ -181,16 +184,14 @@ static int qemu_event_init(void)
     return 0;
 }
 
-extern void qemu_notify_hax_event(void);
-
 void qemu_notify_event(void)
 {
     if (!qemu_event_handle) {
         return;
     }
-#ifdef CONFIG_HAX
+
     qemu_notify_hax_event();
-#endif
+
     if (!SetEvent(qemu_event_handle)) {
         fprintf(stderr, "qemu_notify_event: SetEvent failed: %ld\n",
                 GetLastError());
index dce1cd9d7cab443aca8a563322c7881586cf8605..b84d15dfee0da9de9c9d710b4a5baa3a17dd45ca 100644 (file)
@@ -104,6 +104,14 @@ int main_loop_wait(int nonblocking);
  */
 void qemu_notify_event(void);
 
+#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);
index 9792b06639e4a159912e7e6625a30fad53b485f1..a939f1d66f25e29f53f540318abf12152faa8b9b 100644 (file)
@@ -438,7 +438,7 @@ static void hax_handle_interrupt(CPUArchState *env, int mask)
     }
 }
 
-int hax_pre_init(ram_addr_t ram_size)
+int hax_pre_init(uint64_t ram_size)
 {
        struct hax_state *hax = NULL;