diff options
author | Glauber Costa <glommer@redhat.com> | 2009-06-09 12:15:18 -0400 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-06-16 15:36:47 -0500 |
commit | 950f147249643635289003d7dd291915ad330b29 (patch) | |
tree | 4fbee26dd9364a7bcfac706574e6c7e1afc8d4ef /exec.c | |
parent | 7d9aa9c0994cc6a6c0cf9eeed2f380666d21ba08 (diff) |
provide cpu_index to env mapping
There are some people interested in, given a cpu number,
pick its CPUState. KVM is an example, although not yet in tree.
This patch provides a way of doing that.
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -541,6 +541,19 @@ static int cpu_common_load(QEMUFile *f, void *opaque, int version_id) } #endif +CPUState *qemu_get_cpu(int cpu) +{ + CPUState *env = first_cpu; + + while (env) { + if (env->cpu_index == cpu) + break; + env = env->next_cpu; + } + + return env; +} + void cpu_exec_init(CPUState *env) { CPUState **penv; |