Patchwork [11/11] target-alpha: Make cpu_alpha_init() reentrant

login
register
mail settings
Submitter Andreas Färber
Date Sept. 21, 2012, 2:38 p.m.
Message ID <1348238315-29748-12-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/185793/
State New
Headers show

Comments

Andreas Färber - Sept. 21, 2012, 2:38 p.m.
From: Richard Henderson <rth@twiddle.net>

Guard against duplicate TCG initialization, triggered by linux-user
NPTL emulation.

Signed-off-by: Richard Henderson <rth@twiddle.net>
[AF: Split off into separate patch]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-alpha/translate.c |    6 +++++-
 1 Datei geändert, 5 Zeilen hinzugefügt(+), 1 Zeile entfernt(-)

Patch

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 93063fb..f998f75 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -3525,6 +3525,7 @@  static const struct cpu_def_t cpu_defs[] = {
 
 CPUAlphaState * cpu_alpha_init (const char *cpu_model)
 {
+    static bool inited;
     AlphaCPU *cpu;
     CPUAlphaState *env;
     int implver, amask, i, max;
@@ -3532,7 +3533,10 @@  CPUAlphaState * cpu_alpha_init (const char *cpu_model)
     cpu = ALPHA_CPU(object_new(TYPE_ALPHA_CPU));
     env = &cpu->env;
 
-    alpha_translate_init();
+    if (!inited) {
+        inited = true;
+        alpha_translate_init();
+    }
 
     /* Default to ev67; no reason not to emulate insns by default.  */
     implver = IMPLVER_21264;