mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
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>
This commit is contained in:
parent
9b056fcc5b
commit
182735efaf
39 changed files with 266 additions and 234 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue