target-sh4: Start QOM'ifying CPU init

Move code from cpu_sh4_init() into a QOM initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
Andreas Färber 2012-04-13 02:32:12 +02:00
parent c4bb0f99e7
commit 2b4b490656
2 changed files with 11 additions and 2 deletions

View File

@ -53,6 +53,16 @@ static void superh_cpu_reset(CPUState *s)
set_default_nan_mode(1, &env->fp_status);
}
static void superh_cpu_initfn(Object *obj)
{
SuperHCPU *cpu = SUPERH_CPU(obj);
CPUSH4State *env = &cpu->env;
cpu_exec_init(env);
env->movcal_backup_tail = &(env->movcal_backup);
}
static void superh_cpu_class_init(ObjectClass *oc, void *data)
{
CPUClass *cc = CPU_CLASS(oc);
@ -66,6 +76,7 @@ static const TypeInfo superh_cpu_type_info = {
.name = TYPE_SUPERH_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(SuperHCPU),
.instance_init = superh_cpu_initfn,
.abstract = false,
.class_size = sizeof(SuperHCPUClass),
.class_init = superh_cpu_class_init,

View File

@ -259,8 +259,6 @@ CPUSH4State *cpu_sh4_init(const char *cpu_model)
cpu = SUPERH_CPU(object_new(TYPE_SUPERH_CPU));
env = &cpu->env;
env->features = def->features;
cpu_exec_init(env);
env->movcal_backup_tail = &(env->movcal_backup);
sh4_translate_init();
env->cpu_model_str = cpu_model;
cpu_reset(CPU(cpu));