rt: Add a call stub that switches to the C stack, untested as of yet
This commit is contained in:
parent
1eaaae860f
commit
d8a80cb31f
3
mk/rt.mk
3
mk/rt.mk
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue