X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fruntime%2Fx86-64-assem.S;h=c654861cd30be40ff01372b9376b363b3c6fa61e;hb=5e92e9ed61903658015c2a75c79a32ad41dbd29d;hp=cf5b9705604895ac9e1d2d3d436982bc9a8a71fb;hpb=70c579379283da66f97906a0d62c8a5fc34e4dab;p=sbcl.git diff --git a/src/runtime/x86-64-assem.S b/src/runtime/x86-64-assem.S index cf5b970..c654861 100644 --- a/src/runtime/x86-64-assem.S +++ b/src/runtime/x86-64-assem.S @@ -97,7 +97,7 @@ GNAME(call_into_lisp_first_time): mov THREAD_CONTROL_STACK_START_OFFSET(%rax) ,%rsp /* don't think too hard about what happens if we get interrupted * here */ - add $THREAD_CONTROL_STACK_SIZE-8,%rsp + add $THREAD_CONTROL_STACK_SIZE-16,%rsp jmp Lstack .text @@ -117,20 +117,26 @@ GNAME(call_into_lisp): mov %rsp,%rbp # Establish new frame. Lstack: /* FIXME x86 saves FPU state here */ - push %rbx - push %r12 - push %r13 - push %r14 - push %r15 - + push %rbx # these regs are callee-saved according to C + push %r12 # so must be preserved and restored when + push %r13 # the lisp function returns + push %r14 # + push %r15 # mov %rsp,%rbx # remember current stack push %rbx # Save entry stack on (maybe) new stack. - /* Establish Lisp args. */ - mov %rdi,%rax # lexenv? - mov %rsi,%rbx # address of arg vec - mov %rdx,%rcx # num args + push %rdi # args from C + push %rsi # + push %rdx # +#ifdef LISP_FEATURE_SB_THREAD + mov specials,%rdi + call pthread_getspecific + mov %rax,%r12 +#endif + pop %rcx # num args + pop %rbx # arg vector + pop %rax # function ptr/lexenv xor %rdx,%rdx # clear any descriptor registers xor %rdi,%rdi # that we can't be sure we'll @@ -174,8 +180,9 @@ Lcall: pop %rbx /* FIXME Restore the NPX state. */ - pop %rbp # c-sp + /* return value is already in rax where lisp expects it */ + leave ret .size GNAME(call_into_lisp), . - GNAME(call_into_lisp) @@ -327,12 +334,12 @@ GNAME(post_signal_tramp): popq %r8 popq %rdi popq %rsi - addq $8, %rsp - popq %rsp - popq %rdx + /* skip RBP and RSP */ popq %rbx + popq %rdx popq %rcx popq %rax + popfq leave ret .size GNAME(post_signal_tramp),.-GNAME(post_signal_tramp)