Changeset 10797


Ignore:
Timestamp:
Sep 17, 2008, 10:20:11 PM (11 years ago)
Author:
gb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-spentry32.s

    r10738 r10797  
    42104210        /* arg word 0 at 8(%ebp), word 1 at 12(%ebp), etc. */
    42114211
     4212        /* Reserve some space for results, relative to the
     4213           current %ebp.  We may need quite a bit of it. */
     4214        __(subl $24,%esp)
     4215        __(movl $0,-16(%ebp)) /* No FP result */
     4216        /* If the C stack is 16-byte aligned by convention,
     4217           it should still be, and this'll be a NOP. */
     4218        __(andl $~15,%esp)
    42124219        /* C NVRs */
    42134220        __(push %edi)
     
    42274234          sure that when we push old foreign_sp, %esp will be 16-byte
    42284235          aligned again */
    4229         __(subl $12,%esp)       
     4236        __(subl $8,%esp)
     4237        __(pushl rcontext(tcr.save_ebp))  /* mark cstack frame's "owner" */
    42304238        __(push rcontext(tcr.foreign_sp))
    42314239        __(movl %esp,rcontext(tcr.foreign_sp))
     
    42444252        __(ldmxcsr rcontext(tcr.lisp_mxcsr))
    42454253        __(movl $nrs.callbacks,%fname)
     4254        __(check_cstack_alignment())
    42464255        __(push $local_label(back_from_callback))
    42474256        __(set_nargs(2))
    4248         __(check_cstack_alignment())
    42494257        __(jump_fname())
    42504258__(tra(local_label(back_from_callback)))
     
    42624270        __(pop %esi)
    42634271        __(pop %edi)
    4264         __(movl 8(%ebp),%eax)
    4265         /* doubleword result? */
    4266         /* fp result? */
    4267         __(leave)
    4268         __(ret)
     4272        __(cmpb $1,-16(%ebp))
     4273        __(movl -12(%ebp),%ecx) /* magic value for ObjC bridge */
     4274        __(jae 1f)
     4275        __(movl -8(%ebp),%eax)
     4276        __(movl -4(%ebp),%edx)
     4277        __(leave)
     4278        __(ret)
     42791:      __(jne 2f)
     4280        /* single float return in x87 */
     4281        __(flds -8(%ebp))
     4282        __(leave)
     4283        __(ret)
     42842: /* double-float return in x87 */
     4285        __(fldl -8(%ebp))
     4286        __(leave)
     4287        __(ret)         
    42694288_endsubp(callback)
    42704289
Note: See TracChangeset for help on using the changeset viewer.