[Openmcl-cvs-notifications] r11190 - /trunk/source/lisp-kernel/x86-spentry32.s

gb at clozure.com gb at clozure.com
Tue Oct 21 19:24:27 EDT 2008


Author: gb
Date: Tue Oct 21 19:24:27 2008
New Revision: 11190

Log:
(Untested) support for winapi/pascal-style callbacks.

Modified:
    trunk/source/lisp-kernel/x86-spentry32.s

Modified: trunk/source/lisp-kernel/x86-spentry32.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-spentry32.s (original)
+++ trunk/source/lisp-kernel/x86-spentry32.s Tue Oct 21 19:24:27 2008
@@ -4219,6 +4219,10 @@
            current %ebp.  We may need quite a bit of it. */
         __(subl $24,%esp)
         __(movl $0,-16(%ebp)) /* No FP result */
+        __(movl %eax,%ecx)    /* extract args-discard count */
+        __(shrl $32,%ecx)
+        __(andl $0xff000000,%eax)
+        __(movl %ecx,-12(ebp))
         /* If the C stack is 16-byte aligned by convention,
            it should still be, and this'll be a NOP. */
         __(andl $~15,%esp)
@@ -4227,7 +4231,6 @@
 	__(push %esi)
 	__(push %ebx)
 	__(push %ebp)
-	=

 	__(box_fixnum(%eax,%esi))	/* put callback index in arg_y */
 	__(ref_global(get_tcr,%eax))
 	__(push $1)
@@ -4280,21 +4283,46 @@
 	__(pop %esi)
 	__(pop %edi)
         __(cmpb $1,-16(%ebp))
-        __(movl -12(%ebp),%ecx) /* magic value for ObjC bridge */
+        __(movl -12(%ebp),%ecx) /* magic value for ObjC bridge or winapi */
         __(jae 1f)
 	__(movl -8(%ebp),%eax)
         __(movl -4(%ebp),%edx)
         __(leave)
-	__(ret)
+        __ifdef([WIN_32])
+         __(testl %ecx,%ecx)
+         __(jne local_label(winapi_return)
+         __(repret)
+        __else
+	 __(ret)
+        __endif
 1:      __(jne 2f)
         /* single float return in x87 */
         __(flds -8(%ebp))
         __(leave)
-        __(ret)
+        __ifdef([WIN_32])
+         __(testl %ecx,%ecx)
+         __(jne local_label(winapi_return)
+         __(repret)
+        __else
+	 __(ret)
+        __endif
 2:      /* double-float return in x87 */
         __(fldl -8(%ebp))
         __(leave)
-        __(ret)         =

+        __ifdef([WIN_32])
+         __(testl %ecx,%ecx)
+         __(jne local_label(winapi_return)
+         __(repret)
+        __else
+	 __(ret)
+        __endif
+        __ifdef([WIN_32])
+local_label(winapi_return):             =

+         /* %ecx is non-zero and contains count of arg words to pop */
+          __(popl (%esp,%ecx,4))
+          __(leal -4(%esp,%ecx,4),%esp)
+          __(ret)
+        __endif
 _endsubp(callback)
 =

 /* temp0 =3D array, arg_y =3D i, arg_z =3D j. Typecheck everything.



More information about the Openmcl-cvs-notifications mailing list