mirror of https://gitlab.com/qemu-project/qemu
spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()
Instead of looping over all CPUArchState, use a helper to obtain the desired CPUState directly. Saves a CPUPPCState variable and QOM cast. Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
11ed09cf07
commit
05318a858c
|
@ -130,7 +130,6 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
|
||||||
uint32_t nret, target_ulong rets)
|
uint32_t nret, target_ulong rets)
|
||||||
{
|
{
|
||||||
target_ulong id;
|
target_ulong id;
|
||||||
CPUPPCState *env;
|
|
||||||
CPUState *cpu;
|
CPUState *cpu;
|
||||||
|
|
||||||
if (nargs != 1 || nret != 2) {
|
if (nargs != 1 || nret != 2) {
|
||||||
|
@ -139,12 +138,8 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
|
||||||
}
|
}
|
||||||
|
|
||||||
id = rtas_ld(args, 0);
|
id = rtas_ld(args, 0);
|
||||||
for (env = first_cpu; env; env = env->next_cpu) {
|
cpu = qemu_get_cpu(id);
|
||||||
cpu = CPU(ppc_env_get_cpu(env));
|
if (cpu != NULL) {
|
||||||
if (cpu->cpu_index != id) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cpu->halted) {
|
if (cpu->halted) {
|
||||||
rtas_st(rets, 1, 0);
|
rtas_st(rets, 1, 0);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue