Index: /trunk/source/lisp-kernel/thread_manager.c
===================================================================
--- /trunk/source/lisp-kernel/thread_manager.c	(revision 13868)
+++ /trunk/source/lisp-kernel/thread_manager.c	(revision 13869)
@@ -100,4 +100,6 @@
       (!((where < (pc)lisp_global(HEAP_END)) &&
          (where >= (pc)lisp_global(HEAP_START))) &&
+       (!((where < (pc)(managed_static_area->active)) &&
+	 (where >= (pc)(readonly_area->low)))) &&
        !((where < spentry_end) && (where >= spentry_start)) &&
        !((where < subprims_end) && (where >= subprims_start)) &&
@@ -1947,5 +1949,9 @@
     *pcontext = * (CONTEXT *)(pcontext->Rcx);
 #else
-    *pcontext = * (CONTEXT *)(pcontext->Ecx);
+    if (where == restore_windows_context_start) {
+      *pcontext = * (CONTEXT *)((pcontext->Esp)+4);
+    } else {
+      *pcontext = * (CONTEXT *)(pcontext->Ecx);
+    }
 #endif
   } else {
@@ -1970,4 +1976,9 @@
   }
   tcr->pending_exception_context = NULL;
+  /* We basically never return from an exception unless we
+     were executing lisp code when the exception returned.
+     If that ever changes, we need to know what valence
+     would have been restored here.*/
+  tcr->valence = TCR_STATE_LISP;
 }
 
@@ -2016,4 +2027,6 @@
         if (!((where < (pc)lisp_global(HEAP_END)) &&
               (where >= (pc)lisp_global(HEAP_START))) &&
+	    (!((where < (pc)(managed_static_area->active)) &&
+	      (where >= (pc)(readonly_area->low)))) &&
             !((where < spentry_end) && (where >= spentry_start)) &&
             !((where < subprims_end) && (where >= subprims_start)) &&
