[PULL,02/23] target-m68k: Build the opcode table only once to avoid multithreading issues
diff mbox

Message ID 1477422199-11208-3-git-send-email-laurent@vivier.eu
State New
Headers show

Commit Message

Laurent Vivier Oct. 25, 2016, 7:02 p.m. UTC
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
---
 target-m68k/translate.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch
diff mbox

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index deb5a58..eecb32b 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2841,6 +2841,11 @@  register_opcode (disas_proc proc, uint16_t opcode, uint16_t mask)
    Later insn override earlier ones.  */
 void register_m68k_insns (CPUM68KState *env)
 {
+    /* Build the opcode table only once to avoid
+       multithreading issues. */
+    if (opcode_table[0] != NULL) {
+        return;
+    }
 #define INSN(name, opcode, mask, feature) do { \
     if (m68k_feature(env, M68K_FEATURE_##feature)) \
         register_opcode(disas_##name, 0x##opcode, 0x##mask); \