--- a/src/runtime/x86-64-bsd-os.c
+++ b/src/runtime/x86-64-bsd-os.c
@@ -10,6 +10,10 @@
 
 #if defined(LISP_FEATURE_OPENBSD)
 #include <machine/fpu.h>
+#endif
+
+#if defined(LISP_FEATURE_DRAGONFLY)
+#include <machine/npx.h>
 #endif
 
 /* KLUDGE: There is strong family resemblance in the signal context
@@ -23,7 +27,7 @@
  * entails; unfortunately, currently the situation is worse, not
  * better, than in the above paragraph. */
 
-#if defined(LISP_FEATURE_FREEBSD) || defined(LISP_FEATURE_DARWIN) || defined(LISP_FEATURE_OPENBSD)
+#if defined(LISP_FEATURE_FREEBSD) || defined(LISP_FEATURE_DARWIN) || defined(LISP_FEATURE_OPENBSD) || defined(LISP_FEATURE_DRAGONFLY)
 os_context_register_t *
 os_context_register_addr(os_context_t *context, int offset)
 {
@@ -168,6 +172,19 @@
     return 1;                  /* success */
 }
 
+#if defined(LISP_FEATURE_DRAGONFLY)
+void
+os_restore_fp_control(os_context_t *context)
+{
+    struct envxmm *ex = (struct envxmm*)(&context->uc_mcontext.mc_fpregs);
+    /* reset exception flags and restore control flags on SSE2 FPU */
+    unsigned int temp = (ex->en_mxcsr) & ~0x3F;
+    asm ("ldmxcsr %0" : : "m" (temp));
+    /* same for x87 FPU. */
+    asm ("fldcw %0" : : "m" (ex->en_cw));
+}
+#endif
+
 #if defined(LISP_FEATURE_FREEBSD)
 void
 os_restore_fp_control(os_context_t *context)