cpus: Change qemu_dummy_start_vcpu() argument to CPUState
Pass it to qemu_dummy_cpu_thread_fn(). Use CPUState::env_ptr for cpu_single_env. Prepares for changing qemu_init_vcpu() argument to CPUState. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
48a106bd14
commit
10a9021dfd
15
cpus.c
15
cpus.c
@ -766,8 +766,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
|
|||||||
fprintf(stderr, "qtest is not supported under Windows\n");
|
fprintf(stderr, "qtest is not supported under Windows\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
#else
|
#else
|
||||||
CPUArchState *env = arg;
|
CPUState *cpu = arg;
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
sigset_t waitset;
|
sigset_t waitset;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
@ -782,7 +781,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
|
|||||||
cpu->created = true;
|
cpu->created = true;
|
||||||
qemu_cond_signal(&qemu_cpu_cond);
|
qemu_cond_signal(&qemu_cpu_cond);
|
||||||
|
|
||||||
cpu_single_env = env;
|
cpu_single_env = cpu->env_ptr;
|
||||||
while (1) {
|
while (1) {
|
||||||
cpu_single_env = NULL;
|
cpu_single_env = NULL;
|
||||||
qemu_mutex_unlock_iothread();
|
qemu_mutex_unlock_iothread();
|
||||||
@ -795,7 +794,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
qemu_mutex_lock_iothread();
|
qemu_mutex_lock_iothread();
|
||||||
cpu_single_env = env;
|
cpu_single_env = cpu->env_ptr;
|
||||||
qemu_wait_io_event_common(cpu);
|
qemu_wait_io_event_common(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,14 +1041,12 @@ static void qemu_kvm_start_vcpu(CPUState *cpu)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qemu_dummy_start_vcpu(CPUArchState *env)
|
static void qemu_dummy_start_vcpu(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
|
|
||||||
cpu->thread = g_malloc0(sizeof(QemuThread));
|
cpu->thread = g_malloc0(sizeof(QemuThread));
|
||||||
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
cpu->halt_cond = g_malloc0(sizeof(QemuCond));
|
||||||
qemu_cond_init(cpu->halt_cond);
|
qemu_cond_init(cpu->halt_cond);
|
||||||
qemu_thread_create(cpu->thread, qemu_dummy_cpu_thread_fn, env,
|
qemu_thread_create(cpu->thread, qemu_dummy_cpu_thread_fn, cpu,
|
||||||
QEMU_THREAD_JOINABLE);
|
QEMU_THREAD_JOINABLE);
|
||||||
while (!cpu->created) {
|
while (!cpu->created) {
|
||||||
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
|
||||||
@ -1069,7 +1066,7 @@ void qemu_init_vcpu(void *_env)
|
|||||||
} else if (tcg_enabled()) {
|
} else if (tcg_enabled()) {
|
||||||
qemu_tcg_init_vcpu(cpu);
|
qemu_tcg_init_vcpu(cpu);
|
||||||
} else {
|
} else {
|
||||||
qemu_dummy_start_vcpu(env);
|
qemu_dummy_start_vcpu(cpu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user