rt: Add a call stub that switches to the C stack, untested as of yet

This commit is contained in:
Patrick Walton 2011-09-28 12:26:36 -07:00
parent 1eaaae860f
commit d8a80cb31f
4 changed files with 18 additions and 1 deletions

View File

@ -37,7 +37,8 @@ RUNTIME_CS := rt/sync/timer.cpp \
RUNTIME_LL :=
RUNTIME_S := rt/arch/i386/_context.S
RUNTIME_S := rt/arch/i386/_context.S \
rt/arch/i386/ccall.S
RUNTIME_HDR := rt/globals.h \
rt/rust.h \

14
src/rt/arch/i386/ccall.S Normal file
View File

@ -0,0 +1,14 @@
.text
// upcall_call_c_stack(void (*fn)(), void *new_esp)
.globl _upcall_call_c_stack
_upcall_call_c_stack:
movl %esp,%ecx // grab esp
movl 8(%esp),%eax // save fn
movl 12(%esp),%esp // switch stack
pushl %ecx // save esp on stack
calll *%eax
popl %esp // restore esp
ret

View File

@ -37,6 +37,7 @@ public:
void swap(context &out);
void call(void *f, void *arg, void *sp);
void call(void *f, void *sp);
// Note that this doesn't actually adjust esp. Instead, we adjust esp when
// we actually do the call. This is needed for exception safety -- if the

View File

@ -66,6 +66,7 @@ task_yield
task_join
unsupervise
upcall_alloc_c_stack
upcall_call_c_stack
upcall_cmp_type
upcall_dynastack_alloc
upcall_dynastack_alloc_2