提交 950f1472 编写于 作者: G Glauber Costa 提交者: Anthony Liguori

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: NGlauber Costa <glommer@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 7d9aa9c0
......@@ -743,6 +743,7 @@ int page_check_range(target_ulong start, target_ulong len, int flags);
void cpu_exec_init_all(unsigned long tb_size);
CPUState *cpu_copy(CPUState *env);
CPUState *qemu_get_cpu(int cpu);
void cpu_dump_state(CPUState *env, FILE *f,
int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册