Changeset 10772


Ignore:
Timestamp:
Sep 16, 2008, 12:28:44 PM (11 years ago)
Author:
gb
Message:

x8632 Linux is very fussy about what the stack looks like on return
from a signal handler (but isn't fussy about stack alignment in
general.) Don't push "arg_3' on Linux (it's only ever pushed to
satisfy alignment constraints.)

File:
1 edited

Legend:

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

    r10596 r10772  
    140140   doesn't really get unconfused until the target function - the
    141141   handler - has built its stack frame */
    142 /* Also: do this function and its caller observe ia32 stack-alignment
    143    constraints, whatever they are ? */       
     142/* The lone caller of this function actually doesn't pass arg_3.
     143   On platforms where the C stack must be 16-byte aligned, pushing
     144   4 words (arg_0-arg_3) helps make it aligned before the return
     145   address is (re-)pushed.
     146   On Linux, there are severe constraints on what the top of stack
     147   can look like when rt_sigreturn (the code at the return address)
     148   runs, and there aren't any constraints on stack alignment, so
     149   we don't push "arg_3" on the new stack.*/
    144150_exportfn(C(switch_to_foreign_stack))
    145151        __(addl $4,%esp)        /* discard return address, on wrong stack */
     
    149155        __(pop %ebx)            /* arg_1 */
    150156        __(pop %ecx)            /* arg_2 */
     157        __ifndef([LINUX])       
    151158        __(pop %edx)            /* arg_3 */
     159        __endif
    152160        __(mov %edi,%esp)
    153161        __(pop %edi)            /* Return address pushed by caller */
     162        __ifndef([LINUX])
    154163        __(push %edx)
     164        __endif
    155165        __(push %ecx)
    156166        __(push %ebx)
Note: See TracChangeset for help on using the changeset viewer.