2 * QEMU LoongArch CPU (monitor definitions)
4 * SPDX-FileCopyrightText: 2021 Loongson Technology Corporation Limited
6 * SPDX-License-Identifier: GPL-2.0-or-later
9 #include "qemu/osdep.h"
10 #include "qapi/qapi-commands-machine-target.h"
13 static void loongarch_cpu_add_definition(gpointer data
, gpointer user_data
)
15 ObjectClass
*oc
= data
;
16 CpuDefinitionInfoList
**cpu_list
= user_data
;
17 CpuDefinitionInfo
*info
= g_new0(CpuDefinitionInfo
, 1);
18 const char *typename
= object_class_get_name(oc
);
20 info
->name
= g_strndup(typename
,
21 strlen(typename
) - strlen("-" TYPE_LOONGARCH_CPU
));
22 info
->q_typename
= g_strdup(typename
);
24 QAPI_LIST_PREPEND(*cpu_list
, info
);
27 CpuDefinitionInfoList
*qmp_query_cpu_definitions(Error
**errp
)
29 CpuDefinitionInfoList
*cpu_list
= NULL
;
32 list
= object_class_get_list(TYPE_LOONGARCH_CPU
, false);
33 g_slist_foreach(list
, loongarch_cpu_add_definition
, &cpu_list
);