rt: Get 64-bit Linux __morestack allocating new stacks

This commit is contained in:
Brian Anderson 2011-11-28 18:39:18 -08:00
parent 4dcb0ee0ce
commit ef20afc36c
1 changed files with 10 additions and 5 deletions

View File

@ -48,6 +48,7 @@
.type MORESTACK,@function
#endif
#if defined(__linux)
MORESTACK:
.cfi_startproc
@ -71,14 +72,14 @@ MORESTACK:
addq $16, %rcx // Add the saved %rbp, and return address
addq %r11, %rcx // Add the size of stack arguments
pushq %r10 // The amount of stack needed
pushq %rcx // Address of stack arguments
pushq %r11 // Size of stack arguments
pushq %rbp // Save the Rust stack pointer
pushq %r11 // Size of stack arguments
pushq %rcx // Address of stack arguments
pushq %r10 // The amount of stack needed
// FIXME: Don't understand why I have to use the PLT here
lea RUST_NEW_STACK2@PLT(%rip), %rsi
lea 24(%rsp), %rdi
mov %rsp, %rdi
call UPCALL_CALL_C@PLT
mov (%rsp),%rdx // Grab the return pointer.
@ -86,4 +87,8 @@ MORESTACK:
mov %rax,%rsp // Switch to the new stack.
call *%rdx // Enter the new function.
.cfi_endproc
.cfi_endproc
#else
MORESTACK:
ret
#endif