target-alpha: QOM'ify CPU init

Move code from cpu_alpha_init() into a CPU initializer.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
This commit is contained in:
Andreas Färber 2012-04-07 01:19:45 +02:00
parent 25ebd80f1d
commit 9444006fa6
2 changed files with 21 additions and 11 deletions

View File

@ -1,6 +1,7 @@
/* /*
* QEMU Alpha CPU * QEMU Alpha CPU
* *
* Copyright (c) 2007 Jocelyn Mayer
* Copyright (c) 2012 SUSE LINUX Products GmbH * Copyright (c) 2012 SUSE LINUX Products GmbH
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -22,10 +23,29 @@
#include "qemu-common.h" #include "qemu-common.h"
static void alpha_cpu_initfn(Object *obj)
{
AlphaCPU *cpu = ALPHA_CPU(obj);
CPUAlphaState *env = &cpu->env;
cpu_exec_init(env);
tlb_flush(env, 1);
#if defined(CONFIG_USER_ONLY)
env->ps = PS_USER_MODE;
cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD
| FPCR_UNFD | FPCR_INED | FPCR_DNOD
| FPCR_DYN_NORMAL));
#endif
env->lock_addr = -1;
env->fen = 1;
}
static const TypeInfo alpha_cpu_type_info = { static const TypeInfo alpha_cpu_type_info = {
.name = TYPE_ALPHA_CPU, .name = TYPE_ALPHA_CPU,
.parent = TYPE_CPU, .parent = TYPE_CPU,
.instance_size = sizeof(AlphaCPU), .instance_size = sizeof(AlphaCPU),
.instance_init = alpha_cpu_initfn,
.abstract = false, .abstract = false,
.class_size = sizeof(AlphaCPUClass), .class_size = sizeof(AlphaCPUClass),
}; };

View File

@ -3531,9 +3531,8 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
cpu = ALPHA_CPU(object_new(TYPE_ALPHA_CPU)); cpu = ALPHA_CPU(object_new(TYPE_ALPHA_CPU));
env = &cpu->env; env = &cpu->env;
cpu_exec_init(env);
alpha_translate_init(); alpha_translate_init();
tlb_flush(env, 1);
/* Default to ev67; no reason not to emulate insns by default. */ /* Default to ev67; no reason not to emulate insns by default. */
implver = IMPLVER_21264; implver = IMPLVER_21264;
@ -3551,15 +3550,6 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
env->implver = implver; env->implver = implver;
env->amask = amask; env->amask = amask;
#if defined (CONFIG_USER_ONLY)
env->ps = PS_USER_MODE;
cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD
| FPCR_UNFD | FPCR_INED | FPCR_DNOD
| FPCR_DYN_NORMAL));
#endif
env->lock_addr = -1;
env->fen = 1;
qemu_init_vcpu(env); qemu_init_vcpu(env);
return env; return env;
} }