Fixnum and unsigned-fixnum array cleanups.
[sbcl.git] / src / runtime / x86-64-bsd-os.c
index 93dec52..8c54503 100644 (file)
@@ -8,6 +8,10 @@
 #include <machine/fpu.h>
 #endif
 
+#if defined(LISP_FEATURE_OPENBSD)
+#include <machine/fpu.h>
+#endif
+
 #ifdef LISP_FEATURE_MACH_EXCEPTION_HANDLER
 #include <mach/mach.h>
 
@@ -182,3 +186,16 @@ os_restore_fp_control(os_context_t *context)
     asm ("fldcw %0" : : "m" (ex->en_cw));
 }
 #endif
+
+#if defined(LISP_FEATURE_OPENBSD)
+void
+os_restore_fp_control(os_context_t *context)
+{
+    if (context->sc_fpstate != NULL) {
+        u_int32_t mxcsr = context->sc_fpstate->fx_mxcsr & ~0x3F;
+        u_int16_t cw = context->sc_fpstate->fx_fcw;
+        asm ("ldmxcsr %0" : : "m" (mxcsr));
+        asm ("fldcw %0" : : "m" (cw));
+    }
+}
+#endif