From eeb266ded886185d1d3b0d8bc089ec72df1a2bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 27 Jan 2013 23:25:25 +0100 Subject: target-unicore32: Rename CPU subtypes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the initial conversion of CPU models to QOM types, model names were mapped 1:1 to type names. As a side effect this gained us a type "any", which is now a device. To avoid "-device any" silliness and to pave the way for compiling multiple targets into one executable, adopt a --cpu scheme. No functional changes for -cpu arguments. Signed-off-by: Andreas Färber --- target-unicore32/cpu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'target-unicore32/cpu.c') diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c index 18ef1c5dad..4e4177fc57 100644 --- a/target-unicore32/cpu.c +++ b/target-unicore32/cpu.c @@ -26,12 +26,15 @@ static inline void set_feature(CPUUniCore32State *env, int feature) static ObjectClass *uc32_cpu_class_by_name(const char *cpu_model) { ObjectClass *oc; + char *typename; if (cpu_model == NULL) { return NULL; } - oc = object_class_by_name(cpu_model); + typename = g_strdup_printf("%s-" TYPE_UNICORE32_CPU, cpu_model); + oc = object_class_by_name(typename); + g_free(typename); if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_UNICORE32_CPU) || object_class_is_abstract(oc))) { oc = NULL; @@ -84,7 +87,6 @@ static void uc32_cpu_initfn(Object *obj) CPUUniCore32State *env = &cpu->env; cpu_exec_init(env); - env->cpu_model_str = object_get_typename(obj); #ifdef CONFIG_USER_ONLY env->uncached_asr = ASR_MODE_USER; @@ -114,12 +116,13 @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data) static void uc32_register_cpu_type(const UniCore32CPUInfo *info) { TypeInfo type_info = { - .name = info->name, .parent = TYPE_UNICORE32_CPU, .instance_init = info->instance_init, }; + type_info.name = g_strdup_printf("%s-" TYPE_UNICORE32_CPU, info->name); type_register(&type_info); + g_free((void *)type_info.name); } static const TypeInfo uc32_cpu_type_info = { -- cgit v1.2.3