[Openmcl-cvs-notifications] r10797 - /trunk/source/lisp-kernel/x86-spentry32.s
gb at clozure.com
gb at clozure.com
Wed Sep 17 18:20:11 EDT 2008
Author: gb
Date: Wed Sep 17 18:20:11 2008
New Revision: 10797
Log:
In .SPcallback, don't assume 16-byte stack alignment (depending on
what the constant says.) Reserve space for result words (as part of
enforcing alignment) in the new frame. I'm confused enough about the
Linux ABI that I'm not sure that there'd be always be "room for
outgoing args" when there aren't any outgoing args.
Try to link the foreign frame to the lisp rbp, so that we can do
apply-in-frame once or twice a year.
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 Wed Sep 17 18:20:11 2008
@@ -4209,6 +4209,13 @@
/* C scalar args are already on the stack. */
/* arg word 0 at 8(%ebp), word 1 at 12(%ebp), etc. */
=
+ /* Reserve some space for results, relative to the
+ current %ebp. We may need quite a bit of it. */
+ __(subl $24,%esp)
+ __(movl $0,-16(%ebp)) /* No FP result */
+ /* If the C stack is 16-byte aligned by convention,
+ it should still be, and this'll be a NOP. */
+ __(andl $~15,%esp)
/* C NVRs */
__(push %edi)
__(push %esi)
@@ -4226,7 +4233,8 @@
/* ebp is 16-byte aligned, and we've pushed 4 words. Make
sure that when we push old foreign_sp, %esp will be 16-byte
aligned again */
- __(subl $12,%esp) =
+ __(subl $8,%esp)
+ __(pushl rcontext(tcr.save_ebp)) /* mark cstack frame's "owner" */
__(push rcontext(tcr.foreign_sp))
__(movl %esp,rcontext(tcr.foreign_sp))
__(clr %arg_z)
@@ -4243,9 +4251,9 @@
__(andb $~mxcsr_all_exceptions,rcontext(tcr.foreign_mxcsr))
__(ldmxcsr rcontext(tcr.lisp_mxcsr))
__(movl $nrs.callbacks,%fname)
+ __(check_cstack_alignment())
__(push $local_label(back_from_callback))
__(set_nargs(2))
- __(check_cstack_alignment())
__(jump_fname())
__(tra(local_label(back_from_callback)))
__(movl %esp,rcontext(tcr.save_vsp))
@@ -4261,11 +4269,22 @@
__(pop %ebx)
__(pop %esi)
__(pop %edi)
- __(movl 8(%ebp),%eax)
- /* doubleword result? */
- /* fp result? */
- __(leave)
- __(ret)
+ __(cmpb $1,-16(%ebp))
+ __(movl -12(%ebp),%ecx) /* magic value for ObjC bridge */
+ __(jae 1f)
+ __(movl -8(%ebp),%eax)
+ __(movl -4(%ebp),%edx)
+ __(leave)
+ __(ret)
+1: __(jne 2f)
+ /* single float return in x87 */
+ __(flds -8(%ebp))
+ __(leave)
+ __(ret)
+2: /* double-float return in x87 */
+ __(fldl -8(%ebp))
+ __(leave)
+ __(ret) =
_endsubp(callback)
=
/* temp0 =3D array, arg_y =3D i, arg_z =3D j. Typecheck everything.
More information about the Openmcl-cvs-notifications
mailing list