diff options
author | Andreas Färber <afaerber@suse.de> | 2013-06-24 23:50:24 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-09-03 12:25:55 +0200 |
commit | bdc44640cb33c90809376a262df871a1144d339a (patch) | |
tree | ef3b8d1d6a389d85baeb0cee895471b634a2fc3b /include/qom/cpu.h | |
parent | 27013bf20d5d93ac75d398aa3608604e8ad91b5a (diff) |
cpu: Use QTAILQ for CPU list
Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthand
macros.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'include/qom/cpu.h')
-rw-r--r-- | include/qom/cpu.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 3e4993661a..79f7c8709d 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -23,6 +23,7 @@ #include <signal.h> #include "hw/qdev-core.h" #include "exec/hwaddr.h" +#include "qemu/queue.h" #include "qemu/thread.h" #include "qemu/tls.h" #include "qemu/typedefs.h" @@ -190,7 +191,7 @@ struct CPUState { struct GDBRegisterState *gdb_regs; int gdb_num_regs; int gdb_num_g_regs; - CPUState *next_cpu; + QTAILQ_ENTRY(CPUState) node; int kvm_fd; bool kvm_vcpu_dirty; @@ -202,7 +203,13 @@ struct CPUState { uint32_t halted; /* used by alpha, cris, ppc TCG */ }; -extern CPUState *first_cpu; +QTAILQ_HEAD(CPUTailQ, CPUState); +extern struct CPUTailQ cpus; +#define CPU_NEXT(cpu) QTAILQ_NEXT(cpu, node) +#define CPU_FOREACH(cpu) QTAILQ_FOREACH(cpu, &cpus, node) +#define CPU_FOREACH_SAFE(cpu, next_cpu) \ + QTAILQ_FOREACH_SAFE(cpu, &cpus, node, next_cpu) +#define first_cpu QTAILQ_FIRST(&cpus) DECLARE_TLS(CPUState *, current_cpu); #define current_cpu tls_var(current_cpu) |