Patchwork [7/7] target-ppc: add implementation of query-cpudefs

login
register
mail settings
Submitter Anthony Liguori
Date July 27, 2012, 1:37 p.m.
Message ID <1343396239-19272-8-git-send-email-aliguori@us.ibm.com>
Download mbox | patch
Permalink /patch/173682/
State New
Headers show

Comments

Anthony Liguori - July 27, 2012, 1:37 p.m.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 target-ppc/translate_init.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

Patch

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 5742229..7e025cb 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10345,6 +10345,31 @@  void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf)
     }
 }
 
+CpuDefInfoList *qmp_query_cpudefs(Error **errp)
+{
+    CpuDefInfoList *cpu_list = NULL;
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(ppc_defs); i++) {
+        CpuDefInfoList *entry;
+        CpuDefInfo *info;
+
+        if (!ppc_cpu_usable(&ppc_defs[i])) {
+            continue;
+        }
+
+        info = g_malloc0(sizeof(*info));
+        info->name = g_strdup(pcc_defs[i].name);
+
+        entry = g_malloc0(sizeof(*entry));
+        entry->value = info;
+        entry->next = cpu_list;
+        cpu_list = entry;
+    }
+
+    return cpu_list;
+}
+
 /* CPUClass::reset() */
 static void ppc_cpu_reset(CPUState *s)
 {