From: Richard Henderson Date: Mon, 13 Apr 2026 23:02:51 +0000 (+1000) Subject: linux-user/arm/nwfpe: Use thread-local storage for qemufpa X-Git-Tag: v11.1.0-rc0~151^2~8 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=784f1dde90df1ed57de0697adcd8ebfe7c342f58;p=thirdparty%2Fqemu.git linux-user/arm/nwfpe: Use thread-local storage for qemufpa Fix the thread safety of the emulation by not storing a pointer in global storage. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Helge Deller --- diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c index 44783934b2e..15888463f7a 100644 --- a/linux-user/arm/nwfpe/fpa11.c +++ b/linux-user/arm/nwfpe/fpa11.c @@ -29,7 +29,7 @@ //#include -FPA11* qemufpa = NULL; +__thread FPA11* qemufpa = NULL; /* Reset the FPA11 chip. Called to initialize and reset the emulator. */ void resetFPA11(void) @@ -154,7 +154,6 @@ void SetRoundingPrecision(const unsigned int opcode) } /* Emulate the instruction in the opcode. */ -/* ??? This is not thread safe. */ unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa) { unsigned int nRc = 0; diff --git a/linux-user/arm/nwfpe/fpa11.h b/linux-user/arm/nwfpe/fpa11.h index 20f9d2eb81d..659d38ae3aa 100644 --- a/linux-user/arm/nwfpe/fpa11.h +++ b/linux-user/arm/nwfpe/fpa11.h @@ -74,7 +74,7 @@ typedef struct tagFPA11 { float_status fp_status; /* QEMU float emulator status */ } FPA11; -extern FPA11* qemufpa; +extern __thread FPA11* qemufpa; void resetFPA11(void); void SetRoundingMode(const unsigned int);