[Openmcl-cvs-notifications] r11002 - in /trunk/source/lisp-kernel: x86-asmutils32.s x86-exceptions.c

gb at clozure.com gb at clozure.com
Tue Oct 7 00:10:52 EDT 2008


Author: gb
Date: Tue Oct  7 00:10:52 2008
New Revision: 11002

Log:
Define ensure_safe_for_string_operations() - which clears the direction
flag and ensures that %es =3D %ds - and call it before copying structures
around in windows_arbstack_exception_handler().  (The assembler function
is supposed to trap if %es /=3D %ds; my model of things is that it always
should be.)

Still get occasional faults in memcpy(), so there may be some similar
case that isn't handled right (maybe interrupt/suspend ?).

Modified:
    trunk/source/lisp-kernel/x86-asmutils32.s
    trunk/source/lisp-kernel/x86-exceptions.c

Modified: trunk/source/lisp-kernel/x86-asmutils32.s
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/x86-asmutils32.s (original)
+++ trunk/source/lisp-kernel/x86-asmutils32.s Tue Oct  7 00:10:52 2008
@@ -235,11 +235,27 @@
 C(restore_windows_context_load_rcx):  .long Xrestore_windows_context_load_=
rcx
 C(restore_windows_context_iret): .long Xrestore_windows_context_iret
 =

-
+        __ifdef([WIN32_ES_HACK])
 /* Something that we shouldn't return to */
 _exportfn(C(windows_halt))
         __(hlt)
-_endfn                                =

+_endfn         =

+        __endif
+_exportfn(C(ensure_safe_for_string_operations))
+        __ifdef([WIN32_ES_HACK])
+        __(movw %es,%ax)
+        __(movw %ds,%dx)
+        __(cmpw %ax,%dx)
+        __(jne 9f)
+0:      __(movw %dx,%es)
+        __endif
+        __(cld)        =

+	__(ret)
+        __ifdef ([WIN32_ES_HACK])
+9:      __(hlt)
+        __(jmp 0b)
+        __endif
+_endfn                                       =

         __endif
         _endfile
 =


Modified: trunk/source/lisp-kernel/x86-exceptions.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/lisp-kernel/x86-exceptions.c (original)
+++ trunk/source/lisp-kernel/x86-exceptions.c Tue Oct  7 00:10:52 2008
@@ -1832,7 +1832,10 @@
 LONG CALLBACK
 windows_arbstack_exception_handler(EXCEPTION_POINTERS *exception_pointers)
 {
+  extern void ensure_safe_for_string_operations(void);
   DWORD code =3D exception_pointers->ExceptionRecord->ExceptionCode;
+
+  ensure_safe_for_string_operations();
   =

   if ((code & 0x80000000L) =3D=3D 0) {
     return EXCEPTION_CONTINUE_SEARCH;



More information about the Openmcl-cvs-notifications mailing list