X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Fppc-linux-os.c;h=eac15930853e0ca1d39c835855d4b71e588de4bb;hb=743831e679b673a5680a0afd8402911516bf50e2;hp=fe22e41dc29f6ef5fe2fd20b7baf469901c5053c;hpb=52c61a5ea469c7766ff493f889625394c4038b9a;p=sbcl.git diff --git a/src/runtime/ppc-linux-os.c b/src/runtime/ppc-linux-os.c index fe22e41..eac1593 100644 --- a/src/runtime/ppc-linux-os.c +++ b/src/runtime/ppc-linux-os.c @@ -122,29 +122,21 @@ os_context_fp_control(os_context_t *context) void os_restore_fp_control(os_context_t *context) { - unsigned long control; + /* KLUDGE: mtfsf has to be run against a float register, so we + * construct the float we need to use as an integer, then cast + * a pointer to its storage to a double and load that. For + * this to work, control must be the same width as a double, + * 64 bits. And why aren't we using a union here, anyway? */ + unsigned long long control; double d; + /* FIXME: We are only preserving enabled traps and rounding + * mode here. Do we also want to preserve "fast mode"? */ control = os_context_fp_control(context) & - /* FIXME: Should we preserve the user's requested rounding mode? - - Note that doing - - ~(FLOAT_STICKY_BITS_MASK | FLOAT_EXCEPTIONS_BYTE_MASK) - - here leads to infinite SIGFPE for invalid operations, as - there are bits in the control register that need to be - cleared that are let through by that mask. -- CSR, 2002-07-16 */ - - FLOAT_TRAPS_BYTE_MASK; + (FLOAT_TRAPS_BYTE_MASK | FLOAT_ROUNDING_MODE_MASK); d = *((double *) &control); - /* Hmp. Apparently the following doesn't work either: - asm volatile ("mtfsf 0xff,%0" : : "f" (d)); - - causing segfaults at the first GC. - */ } void