2011-10-12 17:45:17 -05:00
|
|
|
.text
|
|
|
|
|
|
|
|
// upcall_call_c_stack(void (*fn)(), void *new_esp)
|
|
|
|
//
|
|
|
|
// Note that we could use |enter| and |leave| but the manuals tell me they're
|
|
|
|
// slower.
|
|
|
|
#if defined(__APPLE__) || defined(_WIN32)
|
|
|
|
.globl _upcall_call_c_stack
|
|
|
|
_upcall_call_c_stack:
|
|
|
|
#else
|
|
|
|
.globl upcall_call_c_stack
|
|
|
|
upcall_call_c_stack:
|
|
|
|
#endif
|
2011-10-13 19:11:28 -05:00
|
|
|
push %rbp
|
|
|
|
mov %rsp,%rbp // save rsp
|
|
|
|
mov %rsi,%rsp // switch stack
|
|
|
|
call *%rdi
|
|
|
|
mov %rbp,%rsp // would like to use "leave" but it's slower
|
|
|
|
pop %rbp
|
2011-10-12 17:45:17 -05:00
|
|
|
ret
|
|
|
|
|