rt: Give upcall_del_stack the same convention as other upcalls

This commit is contained in:
Brian Anderson 2011-12-19 15:17:49 -08:00
parent 55a2fd18ec
commit bedcaad97e
3 changed files with 17 additions and 24 deletions

View file

@ -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"

View file

@ -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

View file

@ -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