aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-08-17 11:22:08 +0200
committerBjörn Gustavsson <[email protected]>2010-08-17 11:22:08 +0200
commit0f4b1294f51983f834dbca750b3ad271d72f740a (patch)
tree60229fa98c9b759978ecc254822a2473ecea595e /erts/emulator/sys
parent871fdb232d7facc58c202ef81634a12fbdcfefb4 (diff)
downloadotp-0f4b1294f51983f834dbca750b3ad271d72f740a.tar.gz
otp-0f4b1294f51983f834dbca750b3ad271d72f740a.tar.bz2
otp-0f4b1294f51983f834dbca750b3ad271d72f740a.zip
Solaris/x86: Handle floating point exceptions properly in driver threads
On Solaris/x86, the floating point exceptions bits seems to be propagated to child threads, so if scheduler threads use floating points exceptions, also driver threads will have floating points exception enabled. The problem is that erts_thread_init_float() has not been called for driver threads, and because of that matherr() will crash when called. Fix matherr() so that it will work even if erts_thread_init_float() has not been called. This fix was suggested by Mikael Pettersson.
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r--erts/emulator/sys/unix/sys_float.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/erts/emulator/sys/unix/sys_float.c b/erts/emulator/sys/unix/sys_float.c
index c59c99f65e..d6d06d0036 100644
--- a/erts/emulator/sys/unix/sys_float.c
+++ b/erts/emulator/sys/unix/sys_float.c
@@ -810,7 +810,9 @@ int
matherr(struct exception *exc)
{
#if !defined(NO_FPE_SIGNALS)
- set_current_fp_exception((unsigned long)__builtin_return_address(0));
+ volatile unsigned long *fpexnp = erts_get_current_fp_exception();
+ if (fpexnp != NULL)
+ *fpexnp = (unsigned long)__builtin_return_address(0);
#endif
return 1;
}