diff options
author | Andreas Färber <afaerber@suse.de> | 2013-05-29 22:29:20 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-09 21:32:54 +0200 |
commit | 182735efaf956ccab50b6d74a4fed163e0f35660 (patch) | |
tree | 1852a22a43ce7130f22fc96cd96712cfa7e00749 /linux-user/main.c | |
parent | 9b056fcc5becd183fa2bdec9d259bf26b5f71207 (diff) |
cpu: Make first_cpu and next_cpu CPUState
Move next_cpu from CPU_COMMON to CPUState.
Move first_cpu variable to qom/cpu.h.
gdbstub needs to use CPUState::env_ptr for now.
cpu_copy() no longer needs to save and restore cpu_next.
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Rebased, simplified cpu_copy()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'linux-user/main.c')
-rw-r--r-- | linux-user/main.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/linux-user/main.c b/linux-user/main.c index af82db87b8..564bed6e8b 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -120,8 +120,8 @@ void fork_end(int child) if (child) { /* Child processes created by fork() only have a single thread. Discard information about the parent threads. */ - first_cpu = thread_env; - thread_env->next_cpu = NULL; + first_cpu = ENV_GET_CPU(thread_env); + first_cpu->next_cpu = NULL; pending_cpus = 0; pthread_mutex_init(&exclusive_lock, NULL); pthread_mutex_init(&cpu_list_mutex, NULL); @@ -148,7 +148,6 @@ static inline void exclusive_idle(void) Must only be called from outside cpu_arm_exec. */ static inline void start_exclusive(void) { - CPUArchState *other; CPUState *other_cpu; pthread_mutex_lock(&exclusive_lock); @@ -156,8 +155,7 @@ static inline void start_exclusive(void) pending_cpus = 1; /* Make all other cpus stop executing. */ - for (other = first_cpu; other; other = other->next_cpu) { - other_cpu = ENV_GET_CPU(other); + for (other_cpu = first_cpu; other_cpu; other_cpu = other_cpu->next_cpu) { if (other_cpu->running) { pending_cpus++; cpu_exit(other_cpu); |