summaryrefslogtreecommitdiff
path: root/target/mips/translate.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-09-20 16:49:33 -0300
committerYongbok Kim <yongbok.kim@imgtec.com>2017-09-21 13:25:30 +0100
commit41da212c9ce9482fcfd490170c2611470254f8dc (patch)
treeb6cf842d42b55759a92bf6b04745f815d3fb3c6d /target/mips/translate.c
parentdf4dc10284e1d871db8adb512816a561473ffe3e (diff)
downloadqemu-41da212c9ce9482fcfd490170c2611470254f8dc.tar.gz
mips: MIPSCPU model subclasses
Register separate QOM types for each mips cpu model, so it would be possible to reuse generic CPU creation routines. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [PMD: use internal.h, use void* to hold cpu_def in MIPSCPUClass, mark MIPSCPU abstract, address Eduardo Habkost review] Tested-by: James Hogan <james.hogan@imgtec.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Diffstat (limited to 'target/mips/translate.c')
-rw-r--r--target/mips/translate.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 94c38e8755..f7128bc91d 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -20525,16 +20525,15 @@ void cpu_mips_realize_env(CPUMIPSState *env)
MIPSCPU *cpu_mips_init(const char *cpu_model)
{
+ ObjectClass *oc;
MIPSCPU *cpu;
- CPUMIPSState *env;
- const mips_def_t *def;
- def = cpu_mips_find_by_name(cpu_model);
- if (!def)
+ oc = cpu_class_by_name(TYPE_MIPS_CPU, cpu_model);
+ if (oc == NULL) {
return NULL;
- cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
- env = &cpu->env;
- env->cpu_model = def;
+ }
+
+ cpu = MIPS_CPU(object_new(object_class_get_name(oc)));
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);