diff mbox

m68k: Build the opcode table only once to avoid multithreading issues

Message ID 56B36BCD.3020705@physik.fu-berlin.de
State New
Headers show

Commit Message

John Paul Adrian Glaubitz Feb. 4, 2016, 3:18 p.m. UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 02/03/2016 05:11 PM, Eric Blake wrote:
> Weird. Wonder why it doesn't complain on that file?  I'm guessing
> that it is due to the #define on the next line.  Because
> rearranging things to put the code after the #define changes the
> situation (but not the semantics):

Alright, this should do the trick then.

Adrian

- -- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWs2vKAAoJEHQmOzf1tfkTR6MQAJWRekJIKOcxgdpFWWenL5c2
LmLPFtnFN+d4mvrSRuha7onRt/IFQ514oakur93gi45uholK0zR1/KVQPaLN/0ED
jnDUf9z2orJQjn36RnP2HJa4uoTEHQyXfmZ++nKWRlqvxeMNjSiLFzw/NycZapmd
CGllQ9mHX1UKFwbsZJWrrKfDN/jlqMp9Ph8t9pTyehUPsMP5fe+anZWG9cdiUtJI
C/rQUIdzIRi2dAntcVoWOeX6sx+uXfxtHanRdxl5gDv1e53fD9tuSVGnkpqwd0fU
2QKeSvPFh+OTDT4UPLr6ljukzwx2dTEYujtmZPgOz2d4KZg/XMS71vuE9Rjye+O+
y7LXAfamW/gtKAY2QdYSsvxsua7UsitlqOqC4BQ0TCvrdRZufRm6ruL+K45F6zag
brRc//20GYqunS67uw2qo4zh3hJCgv9z8Cah3W4KIRM1T+WhNIiunHQkte5gCkKD
MBZ9JisxNMAK2DnUElHIcY83LDCdfDe3M4T8ndk+4OyBw8SIPGAOO3KEhJ7Q132B
dFpL0zJ/VBPgUCRYedX5+c3YxKJLfFrXv1UZWE4Gt/lbBNqet/Ayv5dHIh48BU1D
u09tCUXjobOK2+H6vKiW60/b/IcNPKSsz35xpJXc91TmMBuYTnUap4ppy2jCTXpY
VBFmKPRgI3q8lhzrkUgh
=SFbP
-----END PGP SIGNATURE-----

Comments

John Paul Adrian Glaubitz Feb. 8, 2016, 11:15 p.m. UTC | #1
On 02/04/2016 04:18 PM, John Paul Adrian Glaubitz wrote:
> On 02/03/2016 05:11 PM, Eric Blake wrote:
>> Weird. Wonder why it doesn't complain on that file?  I'm
>> guessing that it is due to the #define on the next line.
>> Because rearranging things to put the code after the #define
>> changes the situation (but not the semantics):
> 
> Alright, this should do the trick then.

And this one :).
diff mbox

Patch

From 9a78a2f7f8a9063c2ef4dd9b52ffc061d045886b Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Date: Wed, 3 Feb 2016 10:22:35 +0100
Subject: [PATCH 2/2] m68k: Build the opcode table only once to avoid
 multithreading issues

Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
---
 target-m68k/translate.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 535d7f9..015e220 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -2828,6 +2828,12 @@  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); \
-- 
2.7.0