1 /*
2  * QEMU MIPS CPU (monitor definitions)
3  *
4  * SPDX-FileCopyrightText: 2012 SUSE LINUX Products GmbH
5  *
6  * SPDX-License-Identifier: LGPL-2.1-or-later
7  */
8 
9 #include "qemu/osdep.h"
10 #include "qapi/qapi-commands-machine-target.h"
11 #include "cpu.h"
12 
13 static void mips_cpu_add_definition(gpointer data, gpointer user_data)
14 {
15     ObjectClass *oc = data;
16     CpuDefinitionInfoList **cpu_list = user_data;
17     CpuDefinitionInfo *info;
18     const char *typename;
19 
20     typename = object_class_get_name(oc);
21     info = g_malloc0(sizeof(*info));
22     info->name = g_strndup(typename,
23                            strlen(typename) - strlen("-" TYPE_MIPS_CPU));
24     info->q_typename = g_strdup(typename);
25 
26     QAPI_LIST_PREPEND(*cpu_list, info);
27 }
28 
29 CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp)
30 {
31     CpuDefinitionInfoList *cpu_list = NULL;
32     GSList *list;
33 
34     list = object_class_get_list(TYPE_MIPS_CPU, false);
35     g_slist_foreach(list, mips_cpu_add_definition, &cpu_list);
36     g_slist_free(list);
37 
38     return cpu_list;
39 }
40