提交 61a46217 编写于 作者: A Andreas Färber

cpu: Move created field to CPUState

Change its type to bool.
Signed-off-by: NAndreas Färber <afaerber@suse.de>
上级 2ff09a40
...@@ -205,7 +205,6 @@ typedef struct CPUWatchpoint { ...@@ -205,7 +205,6 @@ typedef struct CPUWatchpoint {
/* user data */ \ /* user data */ \
void *opaque; \ void *opaque; \
\ \
uint32_t created; \
uint32_t stop; /* Stop request */ \ uint32_t stop; /* Stop request */ \
uint32_t stopped; /* Artificially stopped */ \ uint32_t stopped; /* Artificially stopped */ \
struct QemuCond *halt_cond; \ struct QemuCond *halt_cond; \
......
...@@ -746,7 +746,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) ...@@ -746,7 +746,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
qemu_kvm_init_cpu_signals(env); qemu_kvm_init_cpu_signals(env);
/* signal CPU creation */ /* signal CPU creation */
env->created = 1; cpu->created = true;
qemu_cond_signal(&qemu_cpu_cond); qemu_cond_signal(&qemu_cpu_cond);
while (1) { while (1) {
...@@ -781,7 +781,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) ...@@ -781,7 +781,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
sigaddset(&waitset, SIG_IPI); sigaddset(&waitset, SIG_IPI);
/* signal CPU creation */ /* signal CPU creation */
env->created = 1; cpu->created = true;
qemu_cond_signal(&qemu_cpu_cond); qemu_cond_signal(&qemu_cpu_cond);
cpu_single_env = env; cpu_single_env = env;
...@@ -818,8 +818,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) ...@@ -818,8 +818,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
/* signal CPU creation */ /* signal CPU creation */
qemu_mutex_lock(&qemu_global_mutex); qemu_mutex_lock(&qemu_global_mutex);
for (env = first_cpu; env != NULL; env = env->next_cpu) { for (env = first_cpu; env != NULL; env = env->next_cpu) {
cpu = ENV_GET_CPU(env);
env->thread_id = qemu_get_thread_id(); env->thread_id = qemu_get_thread_id();
env->created = 1; cpu->created = true;
} }
qemu_cond_signal(&qemu_cpu_cond); qemu_cond_signal(&qemu_cpu_cond);
...@@ -996,7 +997,7 @@ static void qemu_tcg_init_vcpu(void *_env) ...@@ -996,7 +997,7 @@ static void qemu_tcg_init_vcpu(void *_env)
#ifdef _WIN32 #ifdef _WIN32
cpu->hThread = qemu_thread_get_handle(cpu->thread); cpu->hThread = qemu_thread_get_handle(cpu->thread);
#endif #endif
while (env->created == 0) { while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
} }
tcg_cpu_thread = cpu->thread; tcg_cpu_thread = cpu->thread;
...@@ -1015,7 +1016,7 @@ static void qemu_kvm_start_vcpu(CPUArchState *env) ...@@ -1015,7 +1016,7 @@ static void qemu_kvm_start_vcpu(CPUArchState *env)
qemu_cond_init(env->halt_cond); qemu_cond_init(env->halt_cond);
qemu_thread_create(cpu->thread, qemu_kvm_cpu_thread_fn, env, qemu_thread_create(cpu->thread, qemu_kvm_cpu_thread_fn, env,
QEMU_THREAD_JOINABLE); QEMU_THREAD_JOINABLE);
while (env->created == 0) { while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
} }
} }
...@@ -1029,7 +1030,7 @@ static void qemu_dummy_start_vcpu(CPUArchState *env) ...@@ -1029,7 +1030,7 @@ static void qemu_dummy_start_vcpu(CPUArchState *env)
qemu_cond_init(env->halt_cond); qemu_cond_init(env->halt_cond);
qemu_thread_create(cpu->thread, qemu_dummy_cpu_thread_fn, env, qemu_thread_create(cpu->thread, qemu_dummy_cpu_thread_fn, env,
QEMU_THREAD_JOINABLE); QEMU_THREAD_JOINABLE);
while (env->created == 0) { while (!cpu->created) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
} }
} }
......
...@@ -54,6 +54,7 @@ typedef struct CPUClass { ...@@ -54,6 +54,7 @@ typedef struct CPUClass {
/** /**
* CPUState: * CPUState:
* @created: Indicates whether the CPU thread has been successfully created.
* *
* State of one CPU core or thread. * State of one CPU core or thread.
*/ */
...@@ -67,6 +68,7 @@ struct CPUState { ...@@ -67,6 +68,7 @@ struct CPUState {
HANDLE hThread; HANDLE hThread;
#endif #endif
bool thread_kicked; bool thread_kicked;
bool created;
/* TODO Move common fields from CPUArchState here. */ /* TODO Move common fields from CPUArchState here. */
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册