0.7.5.13:
[sbcl.git] / src / runtime / x86-linux-os.c
index 560babb..3d6e8a3 100644 (file)
@@ -79,18 +79,8 @@ os_context_sp_addr(os_context_t *context)
 unsigned long
 os_context_fp_control(os_context_t *context)
 {
-    /* probably the code snippet
-     * #ifdef __linux__
-     *    SET_FPU_CONTROL_WORD(context->__fpregs_mem.cw);
-     * #endif 
-     * is relevant to implementing this correctly */
-
-    /* Note that currently this is not called, as there is an analogous
-     * stub in lisp-land (x86-vm.lisp), also returning 0, with the old
-     * lisp fp-control code. This is here more as a signpost of a possible
-     * way of restoring functionality, and if it is the way to go would
-     * need to be included for other architectures as well. */
-    return 0;
+    return ((((context->uc_mcontext.fpregs->cw) & 0xffff) ^ 0x3f) |
+           (((context->uc_mcontext.fpregs->sw) & 0xffff) << 16));
 }
 
 sigset_t *
@@ -100,6 +90,12 @@ os_context_sigmask_addr(os_context_t *context)
 }
 
 void
+os_restore_fp_control(os_context_t *context)
+{
+    asm ("fldcw %0" : : "m" (context->uc_mcontext.fpregs->cw));
+}
+
+void
 os_flush_icache(os_vm_address_t address, os_vm_size_t length)
 {
 }