aboutsummaryrefslogtreecommitdiff
path: root/target/tilegx
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2017-08-24 18:31:37 +0200
committerEduardo Habkost <ehabkost@redhat.com>2017-09-01 11:54:24 -0300
commit12f4572ec3acde40255328dad60fd8c03281c648 (patch)
tree466f06592750832cdae5ad756c3fc279ed2881c2 /target/tilegx
parentda9cbe02bc0a0c4ee8148da6238eb7bbd61f17f3 (diff)
tilegx: replace cpu_tilegx_init() with cpu_generic_init()
cpu_tilegx_init() always falls back to TYPE_TILEGX_CPU object regardless of cpu_model. Put fallback logic into tilegx_cpu_class_by_name() which would translate any cpu_model into TYPE_TILEGX_CPU class and replace cpu_tilegx_init() with cpu_generic_init(). Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <1503592308-93913-15-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'target/tilegx')
-rw-r--r--target/tilegx/cpu.c11
-rw-r--r--target/tilegx/cpu.h4
2 files changed, 4 insertions, 11 deletions
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
index 45326398cc..7345f5a8b5 100644
--- a/target/tilegx/cpu.c
+++ b/target/tilegx/cpu.c
@@ -52,15 +52,9 @@ static void tilegx_cpu_dump_state(CPUState *cs, FILE *f,
env->pc, env->spregs[TILEGX_SPR_CMPEXCH]);
}
-TileGXCPU *cpu_tilegx_init(const char *cpu_model)
+static ObjectClass *tilegx_cpu_class_by_name(const char *cpu_model)
{
- TileGXCPU *cpu;
-
- cpu = TILEGX_CPU(object_new(TYPE_TILEGX_CPU));
-
- object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
-
- return cpu;
+ return object_class_by_name(TYPE_TILEGX_CPU);
}
static void tilegx_cpu_set_pc(CPUState *cs, vaddr value)
@@ -159,6 +153,7 @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
tcc->parent_reset = cc->reset;
cc->reset = tilegx_cpu_reset;
+ cc->class_by_name = tilegx_cpu_class_by_name;
cc->has_work = tilegx_cpu_has_work;
cc->do_interrupt = tilegx_cpu_do_interrupt;
cc->cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
diff --git a/target/tilegx/cpu.h b/target/tilegx/cpu.h
index f32be49f65..71cea04589 100644
--- a/target/tilegx/cpu.h
+++ b/target/tilegx/cpu.h
@@ -164,9 +164,7 @@ static inline TileGXCPU *tilegx_env_get_cpu(CPUTLGState *env)
void tilegx_tcg_init(void);
int cpu_tilegx_signal_handler(int host_signum, void *pinfo, void *puc);
-TileGXCPU *cpu_tilegx_init(const char *cpu_model);
-
-#define cpu_init(cpu_model) CPU(cpu_tilegx_init(cpu_model))
+#define cpu_init(cpu_model) cpu_generic_init(TYPE_TILEGX_CPU, cpu_model)
#define cpu_signal_handler cpu_tilegx_signal_handler