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 = cpu_model_from_type(typename); 23 info->q_typename = g_strdup(typename); 24 25 QAPI_LIST_PREPEND(*cpu_list, info); 26 } 27 28 CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) 29 { 30 CpuDefinitionInfoList *cpu_list = NULL; 31 GSList *list; 32 33 list = object_class_get_list(TYPE_MIPS_CPU, false); 34 g_slist_foreach(list, mips_cpu_add_definition, &cpu_list); 35 g_slist_free(list); 36 37 return cpu_list; 38 } 39