diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2013-04-24 22:58:04 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-05-01 13:04:18 +0200 |
commit | d6b9e0d60cc511eca210834428bb74508cff3d33 (patch) | |
tree | d7220a74859b39703f59df54265c5f0cf778715b /exec.c | |
parent | 997395d3888fcde6ce41535a8208d7aa919d824b (diff) | |
download | qemu-d6b9e0d60cc511eca210834428bb74508cff3d33.zip |
cpu: Add qemu_for_each_cpu()
Wrapper to avoid open-coded loops and to make CPUState iteration
independent of CPUArchState.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -265,6 +265,16 @@ CPUState *qemu_get_cpu(int index) return env ? cpu : NULL; } +void qemu_for_each_cpu(void (*func)(CPUState *cpu, void *data), void *data) +{ + CPUArchState *env = first_cpu; + + while (env) { + func(ENV_GET_CPU(env), data); + env = env->next_cpu; + } +} + void cpu_exec_init(CPUArchState *env) { CPUState *cpu = ENV_GET_CPU(env); |