From 346910c6389d322be144862c0820c5e4e561a880 Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Thu, 17 Jan 2008 14:13:15 +0000 Subject: [PATCH] Clear the FPU status word before loading the control word from the sigcontext. This is a workaround for an issue on x86/darwin where loading of the control word enabling the invalid operation exception would cause that exception because the status word had that exception. Not sure why this is needed or why the invalid operation exception was set. It was happening in a call run-program while concatenating the files for the hemlock library. --- lisp/Darwin-os.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/Darwin-os.c b/lisp/Darwin-os.c index 66ec9a42c..236d892ed 100644 --- a/lisp/Darwin-os.c +++ b/lisp/Darwin-os.c @@ -14,7 +14,7 @@ * Frobbed for OpenBSD by Pierre R. Mai, 2001. * Frobbed for Darwin by Pierre R. Mai, 2003. * - * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.14 2008/01/03 11:41:53 cshapiro Exp $ + * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/Darwin-os.c,v 1.15 2008/01/17 14:13:15 rtoy Exp $ * */ @@ -269,6 +269,7 @@ restore_fpu(ucontext_t *scp) { unsigned short cw; memcpy(&cw, &scp->uc_mcontext->__fs.__fpu_fcw, sizeof(cw)); + __asm__ __volatile__ ("fclex"); __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw)); } #endif -- GitLab