summary refs log tree commit diff stats
path: root/cpus.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-05-03 06:59:07 +0200
committerAndreas Färber <afaerber@suse.de>2012-10-31 04:12:23 +0100
commit9f09e18a6df39ab11cd80e203c5736af1823f3b3 (patch)
treea068474121d1d07026de378123bae50bbd11cc01 /cpus.c
parentf100f0b38fe43c683f437a8fa3e449d6752f6a58 (diff)
downloadfocaccia-qemu-9f09e18a6df39ab11cd80e203c5736af1823f3b3.tar.gz
focaccia-qemu-9f09e18a6df39ab11cd80e203c5736af1823f3b3.zip
cpu: Move thread_id to CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/cpus.c b/cpus.c
index bee09b996f..d9c332fcb8 100644
--- a/cpus.c
+++ b/cpus.c
@@ -737,7 +737,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg)
 
     qemu_mutex_lock(&qemu_global_mutex);
     qemu_thread_get_self(cpu->thread);
-    env->thread_id = qemu_get_thread_id();
+    cpu->thread_id = qemu_get_thread_id();
     cpu_single_env = env;
 
     r = kvm_init_vcpu(env);
@@ -778,7 +778,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg)
 
     qemu_mutex_lock_iothread();
     qemu_thread_get_self(cpu->thread);
-    env->thread_id = qemu_get_thread_id();
+    cpu->thread_id = qemu_get_thread_id();
 
     sigemptyset(&waitset);
     sigaddset(&waitset, SIG_IPI);
@@ -822,7 +822,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
     qemu_mutex_lock(&qemu_global_mutex);
     for (env = first_cpu; env != NULL; env = env->next_cpu) {
         cpu = ENV_GET_CPU(env);
-        env->thread_id = qemu_get_thread_id();
+        cpu->thread_id = qemu_get_thread_id();
         cpu->created = true;
     }
     qemu_cond_signal(&qemu_cpu_cond);
@@ -1205,7 +1205,8 @@ CpuInfoList *qmp_query_cpus(Error **errp)
     CpuInfoList *head = NULL, *cur_item = NULL;
     CPUArchState *env;
 
-    for(env = first_cpu; env != NULL; env = env->next_cpu) {
+    for (env = first_cpu; env != NULL; env = env->next_cpu) {
+        CPUState *cpu = ENV_GET_CPU(env);
         CpuInfoList *info;
 
         cpu_synchronize_state(env);
@@ -1215,7 +1216,7 @@ CpuInfoList *qmp_query_cpus(Error **errp)
         info->value->CPU = env->cpu_index;
         info->value->current = (env == first_cpu);
         info->value->halted = env->halted;
-        info->value->thread_id = env->thread_id;
+        info->value->thread_id = cpu->thread_id;
 #if defined(TARGET_I386)
         info->value->has_pc = true;
         info->value->pc = env->eip + env->segs[R_CS].base;