diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-12-19 15:17:49 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-12-19 16:24:10 -0800 |
| commit | bedcaad97eaeb5ae09c2782a76d92749ac5585c4 (patch) | |
| tree | c384bfb5cfbac0f3d559d9185e7a788ded09d12a | |
| parent | 55a2fd18ec8f2e9aeee699296b7a500b49ff0c5e (diff) | |
| download | rust-bedcaad97eaeb5ae09c2782a76d92749ac5585c4.tar.gz rust-bedcaad97eaeb5ae09c2782a76d92749ac5585c4.zip | |
rt: Give upcall_del_stack the same convention as other upcalls
| -rw-r--r-- | src/rt/arch/i386/morestack.S | 27 | ||||
| -rw-r--r-- | src/rt/arch/x86_64/morestack.S | 6 | ||||
| -rw-r--r-- | src/rt/rust_upcall.cpp | 8 |
3 files changed, 17 insertions, 24 deletions
diff --git a/src/rt/arch/i386/morestack.S b/src/rt/arch/i386/morestack.S index 3c4e95e3ac1..5804a683028 100644 --- a/src/rt/arch/i386/morestack.S +++ b/src/rt/arch/i386/morestack.S @@ -68,6 +68,7 @@ #if defined(__APPLE__) #define RUST_GET_TASK L_rust_get_task$stub +#define UPCALL_DEL_STACK L_upcall_del_stack$stub #define UPCALL_CALL_C L_upcall_call_shim_on_c_stack$stub #define MORESTACK ___morestack #else @@ -87,8 +88,8 @@ #endif .globl UPCALL_NEW_STACK -.globl UPCALL_DEL_STACK #ifndef __APPLE__ +.globl UPCALL_DEL_STACK .globl RUST_GET_TASK .globl UPCALL_CALL_C_STACK #endif @@ -213,24 +214,13 @@ MORESTACK: // Switch back to the rust stack movl %ebp, %esp - // Remember that __morestack is called misaligned so %ebp - // is not aligned to a 16-byte boundary, these 4 bytes realign. - subl $4, %esp + // Realign stack - remember that __morestack was called misaligned + subl $12, %esp // Now that we're on the return path we want to avoid // stomping on %eax. FIXME: Need to save and restore %eax to // actually preserve it across the call to delete the stack -#ifdef __APPLE__ - call 1f -1: popl %ecx - movl L_upcall_del_stack$non_lazy_ptr-1b(%ecx),%ecx - pushl %ecx -#else - pushl $UPCALL_DEL_STACK -#endif - - pushl $0 - call UPCALL_CALL_C + call UPCALL_DEL_STACK addl $12,%esp @@ -267,9 +257,6 @@ MORESTACK: L_upcall_new_stack$non_lazy_ptr: .indirect_symbol _upcall_new_stack .long 0 -L_upcall_del_stack$non_lazy_ptr: - .indirect_symbol _upcall_del_stack - .long 0 .section __IMPORT,__jump_table,symbol_stubs,pure_instructions+self_modifying_code,5 @@ -278,6 +265,10 @@ L_rust_get_task$stub: .indirect_symbol _rust_get_task .ascii "\364\364\364\364\364" +L_upcall_del_stack$stub: + .indirect_symbol _upcall_del_stack + .ascii "\364\364\364\364\364" + L_upcall_call_shim_on_c_stack$stub: .indirect_symbol _upcall_call_shim_on_c_stack .ascii "\364\364\364\364\364" diff --git a/src/rt/arch/x86_64/morestack.S b/src/rt/arch/x86_64/morestack.S index 9cd37d656ac..f72e7107b5f 100644 --- a/src/rt/arch/x86_64/morestack.S +++ b/src/rt/arch/x86_64/morestack.S @@ -117,13 +117,11 @@ MORESTACK: pushq $0 // FIXME: Should preserve %rax here - movq UPCALL_DEL_STACK@GOTPCREL(%rip), %rsi - movq $0, %rdi #ifdef __APPLE__ - call UPCALL_CALL_C + call UPCALL_DEL_STACK #endif #ifdef __linux__ - call UPCALL_CALL_C@PLT + call UPCALL_DEL_STACK@PLT #endif addq $8, %rsp diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp index 5febc5098a2..981ce0ffb7e 100644 --- a/src/rt/rust_upcall.cpp +++ b/src/rt/rust_upcall.cpp @@ -614,13 +614,17 @@ upcall_new_stack(struct rust_new_stack2_args *args) { args->args_sz); } -// FIXME: As above extern "C" CDECL void -upcall_del_stack() { +upcall_s_del_stack() { rust_task *task = rust_scheduler::get_task(); task->del_stack(); } +extern "C" CDECL void +upcall_del_stack() { + UPCALL_SWITCH_STACK(NULL, upcall_s_del_stack); +} + // Landing pads need to call this to insert the // correct limit into TLS. // NB: This must run on the Rust stack because it |
