@@ -143,6 +143,25 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
#endif
}
+static void hppa_cpu_list_entry(gpointer data, gpointer user_data)
+{
+ const char *typename = object_class_get_name(OBJECT_CLASS(data));
+ char *model = cpu_model_from_type(typename);
+
+ qemu_printf(" %s\n", model);
+ g_free(model);
+}
+
+void hppa_cpu_list(void)
+{
+ GSList *list;
+
+ list = object_class_get_list_sorted(TYPE_HPPA_CPU, false);
+ qemu_printf("Available CPUs:\n");
+ g_slist_foreach(list, hppa_cpu_list_entry, NULL);
+ g_slist_free(list);
+}
+
static void hppa_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
@@ -357,5 +357,8 @@ void hppa_cpu_alarm_timer(void *);
int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr);
#endif
G_NORETURN void hppa_dynamic_excp(CPUHPPAState *env, int excp, uintptr_t ra);
+void hppa_cpu_list(void);
+
+#define cpu_list hppa_cpu_list
#endif /* HPPA_CPU_H */
Implement hppa_cpu_list() to support cpu_list(). With this applied, the available CPU model names, same to the CPU type names, are shown as below. $ ./build/qemu-system-hppa -cpu ? Available CPUs: hppa-cpu Signed-off-by: Gavin Shan <gshan@redhat.com> --- target/hppa/cpu.c | 19 +++++++++++++++++++ target/hppa/cpu.h | 3 +++ 2 files changed, 22 insertions(+)