]> Git Repo - qemu.git/commitdiff
spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()
authorAndreas Färber <[email protected]>
Wed, 29 May 2013 19:03:31 +0000 (21:03 +0200)
committerAndreas Färber <[email protected]>
Wed, 12 Jun 2013 21:43:26 +0000 (23:43 +0200)
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 <[email protected]>
hw/ppc/spapr_rtas.c

index 8ecaa5f8ec96a1ae7630aade7c9b418597113f01..a1c3d204b6d9f06e30d7afdbedc2debd8b2ea0a6 100644 (file)
@@ -130,7 +130,6 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
                                          uint32_t nret, target_ulong rets)
 {
     target_ulong id;
-    CPUPPCState *env;
     CPUState *cpu;
 
     if (nargs != 1 || nret != 2) {
@@ -139,12 +138,8 @@ static void rtas_query_cpu_stopped_state(sPAPREnvironment *spapr,
     }
 
     id = rtas_ld(args, 0);
-    for (env = first_cpu; env; env = env->next_cpu) {
-        cpu = CPU(ppc_env_get_cpu(env));
-        if (cpu->cpu_index != id) {
-            continue;
-        }
-
+    cpu = qemu_get_cpu(id);
+    if (cpu != NULL) {
         if (cpu->halted) {
             rtas_st(rets, 1, 0);
         } else {
This page took 0.028634 seconds and 4 git commands to generate.