rt: Make morestack link on x86_64. Still utterly broken

This commit is contained in:
Brian Anderson 2011-11-17 11:12:59 -08:00
parent d624e523c9
commit a92699fe58

View File

@ -8,9 +8,11 @@
#if defined(__APPLE__) || defined(_WIN32)
#define RUST_NEW_STACK _rust_new_stack
#define RUST_DEL_STACK _rust_del_stack
#define MORESTACK __morestack
#else
#define RUST_NEW_STACK rust_new_stack
#define RUST_DEL_STACK rust_del_stack
#define MORESTACK __morestack
#endif
// Naturally, nobody can agree as to
@ -29,16 +31,16 @@
.globl RUST_NEW_STACK
.globl RUST_DEL_STACK
.globl __morestack
.globl MORESTACK
__morestack:
MORESTACK:
// Hastily and probably incorrectly ported from i386 version.
// Actually this calling convention doens't make so much sense
// for x86_64...
mov %rcx, ARG0 // param 0: amount of space needed
mov %rdx, ARG2 // param 2: size of arguments
lea 8(%rsp),ARG1
call RUST_NEW_STACK
call rust_new_stack_sym
mov (%rsp),%rdx // Grab the return pointer.
inc %rdx // Skip past the `ret`.
@ -47,6 +49,10 @@ __morestack:
// Now the function that called us has returned, so we need to delete the
// old stack space.
call RUST_DEL_STACK
call rust_new_stack_sym
mov %rax,%rsp // Switch back to the old stack.
ret
// This is totally broken
rust_new_stack_sym:
rust_del_stack_sym: