@@ -337,7 +337,6 @@ struct CPUState {
struct QemuThread *thread;
#ifdef _WIN32
- HANDLE hThread;
QemuSemaphore sem;
#endif
int thread_id;
@@ -27,6 +27,9 @@ typedef HANDLE hax_fd;
extern struct hax_state hax_global;
typedef struct AccelCPUState {
+#ifdef _WIN32
+ HANDLE hThread;
+#endif
hax_fd fd;
int vcpu_id;
struct hax_tunnel *tunnel;
@@ -73,7 +73,7 @@ static void hax_start_vcpu_thread(CPUState *cpu)
cpu, QEMU_THREAD_JOINABLE);
assert(cpu->accel);
#ifdef _WIN32
- cpu->hThread = qemu_thread_get_handle(cpu->thread);
+ cpu->accel->hThread = qemu_thread_get_handle(cpu->thread);
#endif
}
@@ -206,7 +206,7 @@ int hax_vcpu_destroy(CPUState *cpu)
hax_close_fd(vcpu->fd);
hax_global.vm->vcpus[vcpu->vcpu_id] = NULL;
#ifdef _WIN32
- CloseHandle(cpu->hThread);
+ CloseHandle(vcpu->hThread);
#endif
g_free(vcpu);
cpu->accel = NULL;
@@ -476,7 +476,7 @@ void hax_kick_vcpu_thread(CPUState *cpu)
*/
cpu->exit_request = 1;
if (!qemu_cpu_is_self(cpu)) {
- if (!QueueUserAPC(dummy_apc_func, cpu->hThread, 0)) {
+ if (!QueueUserAPC(dummy_apc_func, cpu->accel->hThread, 0)) {
fprintf(stderr, "%s: QueueUserAPC failed with error %lu\n",
__func__, GetLastError());
exit(1);