static void cpu_register(const OpenRISCCPUInfo *info)
{
TypeInfo type_info = {
- .name = info->name,
.parent = TYPE_OPENRISC_CPU,
.instance_size = sizeof(OpenRISCCPU),
.instance_init = info->initfn,
.class_size = sizeof(OpenRISCCPUClass),
};
+ type_info.name = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, info->name);
type_register(&type_info);
+ g_free((void *)type_info.name);
}
static const TypeInfo openrisc_cpu_type_info = {
name_a = object_class_get_name(class_a);
name_b = object_class_get_name(class_b);
- if (strcmp(name_a, "any") == 0) {
+ if (strcmp(name_a, "any-" TYPE_OPENRISC_CPU) == 0) {
return 1;
- } else if (strcmp(name_b, "any") == 0) {
+ } else if (strcmp(name_b, "any-" TYPE_OPENRISC_CPU) == 0) {
return -1;
} else {
return strcmp(name_a, name_b);
{
ObjectClass *oc = data;
CPUListState *s = user_data;
+ const char *typename;
+ char *name;
+ typename = object_class_get_name(oc);
+ name = g_strndup(typename,
+ strlen(typename) - strlen("-" TYPE_OPENRISC_CPU));
(*s->cpu_fprintf)(s->file, " %s\n",
- object_class_get_name(oc));
+ name);
+ g_free(name);
}
void cpu_openrisc_list(FILE *f, fprintf_function cpu_fprintf)