add shim upcall func

This commit is contained in:
Niko Matsakis 2011-11-10 22:15:50 -08:00
parent 4fc34e23fa
commit 59e2a0a9c1
1 changed files with 16 additions and 0 deletions

View File

@ -56,3 +56,19 @@ upcall_call_c_stack_float:
pop %rbp
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
push %rbp
mov %rsp,%rbp // save rsp
mov ARG1,%rsp // switch stack
mov ARG0,%r11 // Remember target address
mov ARG1,ARG0 // setup the parameter shim expects
call *%r11
mov %rbp,%rsp
pop %rbp
ret