@@ -25,6 +25,7 @@
#include "isa.h"
#include "pc.h"
#include "sysemu.h"
+#include "kvm.h"
//#define VMPORT_DEBUG
@@ -51,7 +52,7 @@ void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque)
port_state.opaque[command] = opaque;
}
-static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
+static uint32_t vmport_ioport_command(void *opaque, uint32_t addr)
{
VMPortState *s = opaque;
CPUState *env = cpu_single_env;
@@ -76,11 +77,24 @@ static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
return s->func[command](s->opaque[command], addr);
}
+static uint32_t vmport_ioport_read(void *opaque, uint32_t addr)
+{
+ CPUState *env = cpu_single_env;
+ uint32_t result;
+
+ cpu_synchronize_state(env, 0);
+ result = vmport_ioport_command(opaque, addr);
+ cpu_synchronize_state(env, 1);
+ return result;
+}
+
static void vmport_ioport_write(void *opaque, uint32_t addr, uint32_t val)
{
CPUState *env = cpu_single_env;
- env->regs[R_EAX] = vmport_ioport_read(opaque, addr);
+ cpu_synchronize_state(env, 0);
+ env->regs[R_EAX] = vmport_ioport_command(opaque, addr);
+ cpu_synchronize_state(env, 1);
}
static uint32_t vmport_cmd_get_version(void *opaque, uint32_t addr)