aboutsummaryrefslogtreecommitdiff
path: root/target-unicore32/cpu.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-01-20 01:36:47 +0100
committerAndreas Färber <afaerber@suse.de>2013-02-16 14:50:59 +0100
commitd9c27f00b174df070470d48d6577042d2186d969 (patch)
treedb1dee3c47ae884d1560da451512d370a1a0b321 /target-unicore32/cpu.c
parent5266d20a12f2ef01841aad5f1692d73551a39dac (diff)
target-unicore32: Move TCG initialization to UniCore32CPU initfn
Normalize the "inited" logic and add a tcg_enabled() check to suppress it for qtest. Ensures that a QOM-created UniCore32CPU is usable. Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-unicore32/cpu.c')
-rw-r--r--target-unicore32/cpu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index 8de17a49d6..7bcf3b3658 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -95,6 +95,7 @@ static void uc32_cpu_initfn(Object *obj)
{
UniCore32CPU *cpu = UNICORE32_CPU(obj);
CPUUniCore32State *env = &cpu->env;
+ static bool inited;
cpu_exec_init(env);
@@ -107,6 +108,11 @@ static void uc32_cpu_initfn(Object *obj)
#endif
tlb_flush(env, 1);
+
+ if (tcg_enabled() && !inited) {
+ inited = true;
+ uc32_translate_init();
+ }
}
static const VMStateDescription vmstate_uc32_cpu = {