Skip to content

Commit

Permalink
target-ppc: add implementation of query-cpu-definitions (v2)
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
  • Loading branch information
Anthony Liguori authored and Luiz Capitulino committed Aug 13, 2012
1 parent e396612 commit 70b7660
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions target-ppc/translate_init.c
Expand Up @@ -27,6 +27,7 @@
#include "gdbstub.h"
#include <kvm.h>
#include "kvm_ppc.h"
#include "qmp-commands.h"

//#define PPC_DUMP_CPU
//#define PPC_DEBUG_SPR
Expand Down Expand Up @@ -10345,6 +10346,31 @@ void ppc_cpu_list (FILE *f, fprintf_function cpu_fprintf)
}
}

CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
{
CpuDefinitionInfoList *cpu_list = NULL;
int i;

for (i = 0; i < ARRAY_SIZE(ppc_defs); i++) {
CpuDefinitionInfoList *entry;
CpuDefinitionInfo *info;

if (!ppc_cpu_usable(&ppc_defs[i])) {
continue;
}

info = g_malloc0(sizeof(*info));
info->name = g_strdup(ppc_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)
{
Expand Down

0 comments on commit 70b7660

Please sign in to comment.