diff mbox

[09/25] Monitor: Move qmp_query_cpus() up in monitor.c

Message ID 1291659852-23028-10-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino Dec. 6, 2010, 6:23 p.m. UTC
So that next commit can change monitor_print_cpus() to call it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |   78 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 39 insertions(+), 39 deletions(-)
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 3091a1a..f067d07 100644
--- a/monitor.c
+++ b/monitor.c
@@ -854,6 +854,45 @@  static void do_info_registers(Monitor *mon)
 #endif
 }
 
+static void qmp_query_cpus(Monitor *mon, QObject **ret_data)
+{
+    CPUState *env;
+    QList *cpu_list;
+
+    cpu_list = qlist_new();
+
+    /* just to set the default cpu if not already done */
+    mon_get_cpu();
+
+    for(env = first_cpu; env != NULL; env = env->next_cpu) {
+        QDict *cpu;
+        QObject *obj;
+
+        cpu_synchronize_state(env);
+
+        obj = qobject_from_jsonf("{ 'CPU': %d, 'current': %i, 'halted': %i }",
+                                 env->cpu_index, env == mon->mon_cpu,
+                                 env->halted);
+
+        cpu = qobject_to_qdict(obj);
+
+#if defined(TARGET_I386)
+        qdict_put(cpu, "pc", qint_from_int(env->eip + env->segs[R_CS].base));
+#elif defined(TARGET_PPC)
+        qdict_put(cpu, "nip", qint_from_int(env->nip));
+#elif defined(TARGET_SPARC)
+        qdict_put(cpu, "pc", qint_from_int(env->pc));
+        qdict_put(cpu, "npc", qint_from_int(env->npc));
+#elif defined(TARGET_MIPS)
+        qdict_put(cpu, "PC", qint_from_int(env->active_tc.PC));
+#endif
+
+        qlist_append(cpu_list, cpu);
+    }
+
+    *ret_data = QOBJECT(cpu_list);
+}
+
 static void print_cpu_iter(QObject *obj, void *opaque)
 {
     QDict *cpu;
@@ -901,45 +940,6 @@  static void monitor_print_cpus(Monitor *mon, const QObject *data)
     qlist_iter(cpu_list, print_cpu_iter, mon);
 }
 
-static void qmp_query_cpus(Monitor *mon, QObject **ret_data)
-{
-    CPUState *env;
-    QList *cpu_list;
-
-    cpu_list = qlist_new();
-
-    /* just to set the default cpu if not already done */
-    mon_get_cpu();
-
-    for(env = first_cpu; env != NULL; env = env->next_cpu) {
-        QDict *cpu;
-        QObject *obj;
-
-        cpu_synchronize_state(env);
-
-        obj = qobject_from_jsonf("{ 'CPU': %d, 'current': %i, 'halted': %i }",
-                                 env->cpu_index, env == mon->mon_cpu,
-                                 env->halted);
-
-        cpu = qobject_to_qdict(obj);
-
-#if defined(TARGET_I386)
-        qdict_put(cpu, "pc", qint_from_int(env->eip + env->segs[R_CS].base));
-#elif defined(TARGET_PPC)
-        qdict_put(cpu, "nip", qint_from_int(env->nip));
-#elif defined(TARGET_SPARC)
-        qdict_put(cpu, "pc", qint_from_int(env->pc));
-        qdict_put(cpu, "npc", qint_from_int(env->npc));
-#elif defined(TARGET_MIPS)
-        qdict_put(cpu, "PC", qint_from_int(env->active_tc.PC));
-#endif
-
-        qlist_append(cpu_list, cpu);
-    }
-
-    *ret_data = QOBJECT(cpu_list);
-}
-
 static int do_cpu_set(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     int index = qdict_get_int(qdict, "index");