diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2011-11-10 09:14:53 -0800 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2011-11-16 15:16:40 -0800 |
| commit | 85083ec51b57ed5a44ce34c8b3610ca66dff7a68 (patch) | |
| tree | 1c784554a3beb26ca0767f86262ca920ecd2331d /src/rt | |
| parent | bfbaa3d1e1b43eda2016a936dd4095bd79e64a1b (diff) | |
| download | rust-85083ec51b57ed5a44ce34c8b3610ca66dff7a68.tar.gz rust-85083ec51b57ed5a44ce34c8b3610ca66dff7a68.zip | |
begin efforts to use shim functions for c-stack calls
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/arch/i386/ccall.S | 18 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/rt/arch/i386/ccall.S b/src/rt/arch/i386/ccall.S index d901666c6a4..3e32de879a7 100644 --- a/src/rt/arch/i386/ccall.S +++ b/src/rt/arch/i386/ccall.S @@ -1,6 +1,6 @@ .text -// upcall_call_c_stack(void (*fn)(), void *new_esp) +// upcall_call_c_stack(void (*fn)(), void *arg_struct) // // Note that we could use |enter| and |leave| but the manuals tell me they're // slower. @@ -28,3 +28,19 @@ upcall_call_c_stack_float: popl %ebp ret +#if defined(__APPLE__) || defined(_WIN32) +.globl _upcall_call_c_stack_shim +_upcall_call_c_stack_shim: +#else +.globl upcall_call_c_stack_shim +upcall_call_c_stack_shim: +#endif + pushl %ebp + movl %esp,%ebp // save esp + movl 8(%esp),%eax // eax = callee + movl 12(%esp),%esp // switch stack + pushl %esp // push ptr to new arguments + calll *%eax + movl %ebp,%esp // would like to use "leave" but it's slower + popl %ebp + ret diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index d891fc16904..e9951a75d35 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -53,6 +53,7 @@ upcall_alloc_c_stack upcall_call_c_stack upcall_call_c_stack_i64 upcall_call_c_stack_float +upcall_call_c_stack_shim upcall_cmp_type upcall_dynastack_alloc upcall_dynastack_alloc_2 |
