Index: /trunk/source/lisp-kernel/x86-spentry64.s
===================================================================
--- /trunk/source/lisp-kernel/x86-spentry64.s	(revision 14424)
+++ /trunk/source/lisp-kernel/x86-spentry64.s	(revision 14425)
@@ -3990,7 +3990,14 @@
         __(movq %rbp,rcontext(tcr.save_rbp))
 	__(movq $TCR_STATE_FOREIGN,rcontext(tcr.valence))
+        __(movq rcontext(tcr.foreign_sp),%rsp)
+        __ifdef(`WINDOWS')
+	__(stmxcsr rcontext(tcr.lisp_mxcsr))
+        __else
 	__(movq $0,rcontext(tcr.ffi_exception))
-        __(movq rcontext(tcr.foreign_sp),%rsp)
+        __endif
 	__(emms)
+        __ifdef(`WINDOWS')
+	__(ldmxcsr rcontext(tcr.foreign_mxcsr))
+        __endif
 	__(movq (%rsp),%rbp)
         __ifdef(`DARWIN_GS_HACK')
@@ -4070,4 +4077,5 @@
 	__(pxor %fpzero,%fpzero)
 
+        __ifndef(`WINDOWS')
 	/* If we got a floating-point exception during the ff-call,
 	   our handler will have set a flag, preserved lisp's MXCSR,
@@ -4075,4 +4083,5 @@
 	__(btrq $TCR_FLAG_BIT_FOREIGN_FPE,rcontext(tcr.flags))
 	__(jnc 1f)
+        __endif
         __(cmpb $0,C(bogus_fp_exceptions)(%rip))
         __(je 0f)
@@ -4080,5 +4089,7 @@
         __(jmp 1f)
 0:      __(stmxcsr rcontext(tcr.ffi_exception))
+        __ifndef(`WINDOWS')
 	__(ldmxcsr rcontext(tcr.lisp_mxcsr)) /* preserved by the handler */
+        __endif
 1:      __(movq rcontext(tcr.save_vsp),%rsp)
         __(movq rcontext(tcr.save_rbp),%rbp)
@@ -4096,4 +4107,7 @@
 	__(pop %temp2)
 	__(pop %temp1)
+        __ifdef(`WINDOWS')
+	__(ldmxcsr rcontext(tcr.lisp_mxcsr))
+        __endif
 	__(check_pending_interrupt(%temp0))
 	__(pop %temp0)
