From 9f4a1f5e28345dcb521ab5c33d6111c9aeacb7ba Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Sat, 21 Oct 2000 13:01:23 +0000
Subject: [PATCH] Take more care when restoring the FPU control word for linux,
 as there may not be a fpstate in some rare cases.

---
 lisp/interrupt.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/lisp/interrupt.c b/lisp/interrupt.c
index 2c484f08f..0bb24cbb1 100644
--- a/lisp/interrupt.c
+++ b/lisp/interrupt.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.23 2000/10/21 12:42:46 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.24 2000/10/21 13:01:23 dtc Exp $ */
 
 /* Interrupt handing magic. */
 
@@ -360,14 +360,6 @@ maybe_now_maybe_later(HANDLER_ARGS)
 
     SAVE_CONTEXT(); /**/
 
-#if defined(__linux__) && defined(i386)
-    /*
-     * Restore the FPU control word, setting the rounding mode to nearest.
-     */
-
-    setfpucw(contextstruct.fpstate->cw & ~0xc00);
-#endif
-
     if (SymbolValue(INTERRUPTS_ENABLED) == NIL) {
         pending_signal = signal;
         pending_code = DEREFCODE(code);
@@ -420,12 +412,22 @@ maybe_now_maybe_later(HANDLER_ARGS)
 #endif /* POSIX_SIGS */
 
 	arch_set_pseudo_atomic_interrupted(context);
-    } else
+    } else {
+#if defined(__linux__) && defined(i386)
+      /*
+       * Restore the FPU control word, setting the rounding mode to nearest.
+       */
+
+      if (contextstruct.fpstate)
+	setfpucw(contextstruct.fpstate->cw & ~0xc00);
+#endif
+
 #if ( defined( __linux__ ) && defined( i386 ) )
         interrupt_handle_now(signal, contextstruct);
 #else
         interrupt_handle_now(signal, code, context);
 #endif
+    }
 }
 
 /****************************************************************\
-- 
GitLab