aboutsummaryrefslogtreecommitdiff
path: root/target-alpha/cpu.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-04-07 01:19:45 +0200
committerAndreas Färber <afaerber@suse.de>2012-04-15 21:26:55 +0200
commit9444006fa6ba1d5e4079ee534a7236124b66ea77 (patch)
treeaacf9e6b03482dfca8aae582549df08deb07c6e6 /target-alpha/cpu.c
parent25ebd80f1d0e4b8863968d56ccfe634ea577d365 (diff)
downloadqemu-9444006fa6ba1d5e4079ee534a7236124b66ea77.zip
qemu-9444006fa6ba1d5e4079ee534a7236124b66ea77.tar.gz
qemu-9444006fa6ba1d5e4079ee534a7236124b66ea77.tar.bz2
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>
Diffstat (limited to 'target-alpha/cpu.c')
-rw-r--r--target-alpha/cpu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 315b0c1..62d2a66 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -1,6 +1,7 @@
/*
* QEMU Alpha CPU
*
+ * Copyright (c) 2007 Jocelyn Mayer
* Copyright (c) 2012 SUSE LINUX Products GmbH
*
* This library is free software; you can redistribute it and/or
@@ -22,10 +23,29 @@
#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 = {
.name = TYPE_ALPHA_CPU,
.parent = TYPE_CPU,
.instance_size = sizeof(AlphaCPU),
+ .instance_init = alpha_cpu_initfn,
.abstract = false,
.class_size = sizeof(AlphaCPUClass),
};