aboutsummaryrefslogtreecommitdiff
path: root/target-microblaze
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-12 02:34:40 +0200
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2012-04-24 16:04:56 +0200
commitd0e71ef56fa22b7434d4e9f277a2091b2981ef98 (patch)
tree44aaf5edec1ae5523c5da6b90941ebfaeeb0b8bd /target-microblaze
parent61b6208f8e2bfee096fbeefa20744dcc87c2530e (diff)
target-microblaze: QOM'ify CPU init
Move code from cpu_mb_init() to a QOM initfn. Signed-off-by: Andreas Färber <afaerber@suse.de> Tested-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com> [AF: Leave cpu_reset() call in cpu_mb_init()]
Diffstat (limited to 'target-microblaze')
-rw-r--r--target-microblaze/cpu.c11
-rw-r--r--target-microblaze/translate.c2
2 files changed, 11 insertions, 2 deletions
diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
index 6f00b0d13a..9c3b74ea8a 100644
--- a/target-microblaze/cpu.c
+++ b/target-microblaze/cpu.c
@@ -83,6 +83,16 @@ static void mb_cpu_reset(CPUState *s)
#endif
}
+static void mb_cpu_initfn(Object *obj)
+{
+ MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);
+ CPUMBState *env = &cpu->env;
+
+ cpu_exec_init(env);
+
+ set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
+}
+
static void mb_cpu_class_init(ObjectClass *oc, void *data)
{
CPUClass *cc = CPU_CLASS(oc);
@@ -96,6 +106,7 @@ static const TypeInfo mb_cpu_type_info = {
.name = TYPE_MICROBLAZE_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(MicroBlazeCPU),
+ .instance_init = mb_cpu_initfn,
.class_size = sizeof(MicroBlazeCPUClass),
.class_init = mb_cpu_class_init,
};
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index e730c3261c..742b3957c0 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1899,10 +1899,8 @@ CPUMBState *cpu_mb_init (const char *cpu_model)
cpu = MICROBLAZE_CPU(object_new(TYPE_MICROBLAZE_CPU));
env = &cpu->env;
- cpu_exec_init(env);
cpu_reset(CPU(cpu));
qemu_init_vcpu(env);
- set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
if (tcg_initialized)
return env;