[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qom-cpu for-1.4] target-unicore32: Rename CPU subtyp
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH qom-cpu for-1.4] target-unicore32: Rename CPU subtypes |
Date: |
Sun, 27 Jan 2013 23:50:47 +0100 |
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 <name>-<arch>-cpu scheme.
No functional changes for -cpu arguments.
Signed-off-by: Andreas Färber <address@hidden>
---
target-unicore32/cpu.c | 8 ++++++--
1 Datei geändert, 6 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index c120440..28c2fa0 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -25,12 +25,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;
@@ -106,12 +109,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 = {
--
1.7.10.4
- [Qemu-devel] [PATCH qom-cpu for-1.4] target-unicore32: Rename CPU subtypes,
Andreas Färber <=