Changeset 9773


Ignore:
Timestamp:
Jun 17, 2008, 8:25:52 AM (11 years ago)
Author:
gb
Message:

switch_to_foreign_stack: was very wrong, now less wrong.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/lisp-kernel/x86-asmutils32.s

    r8065 r9773  
    137137/* switch_to_foreign_stack(new_sp, func, arg_0, arg_1, arg_2, arg_3)  */
    138138/*   Not fully general, but should get us off of the signal stack */
     139/* Beware: on Darwin, GDB can get very confused by this code, and
     140   doesn't really get unconfused until the target function - the
     141   handler - has built its stack frame */
     142/* Also: do this function and its caller observe ia32 stack-alignment
     143   constraints, whatever they are ? */       
    139144_exportfn(C(switch_to_foreign_stack))
    140         __(movl 4(%eax),%esp)
    141         __(movl 8(%eax),%ecx)   /* handler */
    142         __(push 24(%eax))
    143         __(push 20(%eax))
    144         __(push 16(%eax))
    145         __(push 8(%eax))
    146         __(jmp *%ecx)
     145        __(addl $4,%esp)        /* discard return address, on wrong stack */
     146        __(pop %edi)            /* new esp */
     147        __(pop %esi)            /* handler */
     148        __(pop %eax)            /* arg_0 */
     149        __(pop %ebx)            /* arg_1 */
     150        __(pop %ecx)            /* arg_2 */
     151        __(pop %edx)            /* arg_3 */
     152        __(mov %edi,%esp)
     153        __(pop %edi)            /* Return address pushed by caller */
     154        __(push %edx)
     155        __(push %ecx)
     156        __(push %ebx)
     157        __(push %eax)
     158        __(push %edi)           /* On some platforms, we don't really return */
     159        __(jmp *%esi)
    147160_endfn
    148161
Note: See TracChangeset for help on using the changeset viewer.