rust/src/rt/arch/x86_64/ccall.S

30 lines
749 B
ArmAsm
Raw Normal View History

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
2011-11-01 20:20:54 -05:00
.globl _upcall_call_c_stack_i64
.globl _upcall_call_c_stack_float
2011-10-12 17:45:17 -05:00
_upcall_call_c_stack:
2011-11-01 20:20:54 -05:00
_upcall_call_c_stack_i64:
_upcall_call_c_stack_float:
2011-10-12 17:45:17 -05:00
#else
.globl upcall_call_c_stack
2011-11-01 20:20:54 -05:00
.globl upcall_call_c_stack_i64
.globl upcall_call_c_stack_float
2011-10-12 17:45:17 -05:00
upcall_call_c_stack:
2011-11-01 20:20:54 -05:00
upcall_call_c_stack_i64:
upcall_call_c_stack_float:
2011-10-12 17:45:17 -05:00
#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