mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
cpus: Move CPU code from exec.c to cpus-common.c
This code was introduced with SMP support in commit6a00d60127
, later commit267f685b8b
moved CPU list management to common code but forgot this code. Move now and simplify ifdef'ry. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200702104017.14057-1-philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
cbe0dad190
commit
421a75e283
2 changed files with 18 additions and 22 deletions
|
@ -72,6 +72,8 @@ static int cpu_get_free_index(void)
|
|||
return max_cpu_index;
|
||||
}
|
||||
|
||||
CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
|
||||
|
||||
void cpu_list_add(CPUState *cpu)
|
||||
{
|
||||
QEMU_LOCK_GUARD(&qemu_cpu_list_lock);
|
||||
|
@ -96,6 +98,22 @@ void cpu_list_remove(CPUState *cpu)
|
|||
cpu->cpu_index = UNASSIGNED_CPU_INDEX;
|
||||
}
|
||||
|
||||
CPUState *qemu_get_cpu(int index)
|
||||
{
|
||||
CPUState *cpu;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
if (cpu->cpu_index == index) {
|
||||
return cpu;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* current CPU in the current thread. It is only valid inside cpu_exec() */
|
||||
__thread CPUState *current_cpu;
|
||||
|
||||
struct qemu_work_item {
|
||||
QSIMPLEQ_ENTRY(qemu_work_item) node;
|
||||
run_on_cpu_func func;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue