From ef20afc36ca7083c910fa05ea28576fe4b465783 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Mon, 28 Nov 2011 18:39:18 -0800 Subject: [PATCH] rt: Get 64-bit Linux __morestack allocating new stacks --- src/rt/arch/x86_64/morestack.S | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/rt/arch/x86_64/morestack.S b/src/rt/arch/x86_64/morestack.S index 1113194affc..6cac7289fd8 100644 --- a/src/rt/arch/x86_64/morestack.S +++ b/src/rt/arch/x86_64/morestack.S @@ -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 \ No newline at end of file + .cfi_endproc +#else +MORESTACK: + ret +#endif \ No newline at end of file