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 <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Helge Deller <deller@gmx.de>
Richard Henderson committed
Apr 14, 2026 at 09:02 UTC
784f1dde90df1ed57de0697adcd8ebfe7c342f58
2 files changed
+2
-3
linux-user/arm/nwfpe/fpa11.c
+1
-2
@@ -29,7 +29,7 @@
29
//#include <asm/system.h>
30
31
32
-FPA11* qemufpa = NULL;
32
+__thread FPA11* qemufpa = NULL;
33
34
/* Reset the FPA11 chip. Called to initialize and reset the emulator. */
35
void resetFPA11(void)
@@ -154,7 +154,6 @@ void SetRoundingPrecision(const unsigned int opcode)
154
}
155
156
/* Emulate the instruction in the opcode. */
157
-/* ??? This is not thread safe. */
157
unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa)
158
{
159
unsigned int nRc = 0;
linux-user/arm/nwfpe/fpa11.h
+1
-1
@@ -74,7 +74,7 @@ typedef struct tagFPA11 {
74
float_status fp_status; /* QEMU float emulator status */
75
} FPA11;
76
77
-extern FPA11* qemufpa;
77
+extern __thread FPA11* qemufpa;
78
79
void resetFPA11(void);
80
void SetRoundingMode(const unsigned int);