[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-upstream-unstable] cpu: Add qemu_for_each_cpu()
commit 0170b3ce88cb87346afa369a89ce9b197389058b Author: Michael S. Tsirkin <mst@xxxxxxxxxx> AuthorDate: Wed Apr 24 22:58:04 2013 +0200 Commit: Anthony PERARD <anthony.perard@xxxxxxxxxx> CommitDate: Fri Jun 14 17:43:38 2013 +0100 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@xxxxxxxxxx> Signed-off-by: Igor Mammedov <imammedo@xxxxxxxxxx> Signed-off-by: Andreas Färber <afaerber@xxxxxxx> (cherry picked from QEMU commit d6b9e0d60cc511eca210834428bb74508cff3d33) Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- exec.c | 10 ++++++++++ include/qemu/cpu.h | 9 +++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) diff --git a/exec.c b/exec.c index 8435de0..9fb6927 100644 --- a/exec.c +++ b/exec.c @@ -692,6 +692,16 @@ CPUArchState *qemu_get_cpu(int cpu) return env; } +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) { #ifndef CONFIG_USER_ONLY diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h index 8d2e0cb..23b8b6f 100644 --- a/include/qemu/cpu.h +++ b/include/qemu/cpu.h @@ -138,5 +138,14 @@ bool cpu_is_stopped(CPUState *cpu); */ void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data); +/** + * qemu_for_each_cpu: + * @func: The function to be executed. + * @data: Data to pass to the function. + * + * Executes @func for each CPU. + */ +void qemu_for_each_cpu(void (*func)(CPUState *cpu, void *data), void *data); + #endif -- generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |