2011-12-19 21:50:52 -06:00
|
|
|
/*
|
|
|
|
The function for switching to the C stack. It is called
|
|
|
|
__morestack because gdb allows any frame with that name to
|
|
|
|
move the stack pointer to a different stack, which it usually
|
|
|
|
considers an error.
|
|
|
|
*/
|
|
|
|
|
2011-11-09 13:01:12 -06:00
|
|
|
#include "regs.h"
|
|
|
|
|
|
|
|
#define ARG0 RUSTRT_ARG0_S
|
|
|
|
#define ARG1 RUSTRT_ARG1_S
|
2011-11-18 17:40:23 -06:00
|
|
|
#define ARG2 RUSTRT_ARG2_S
|
2011-11-09 13:01:12 -06:00
|
|
|
|
|
|
|
.text
|
2011-10-12 17:45:17 -05:00
|
|
|
|
2011-11-18 17:40:23 -06:00
|
|
|
#if defined(__APPLE__) || defined(_WIN32)
|
2011-12-19 21:50:52 -06:00
|
|
|
.globl ___morestack
|
|
|
|
.private_extern MORESTACK
|
|
|
|
___morestack:
|
2011-11-18 17:40:23 -06:00
|
|
|
#else
|
2011-12-19 21:50:52 -06:00
|
|
|
.globl __morestack
|
|
|
|
.hidden __morestack
|
|
|
|
__morestack:
|
2011-11-18 17:40:23 -06:00
|
|
|
#endif
|
2011-12-11 15:38:04 -06:00
|
|
|
|
|
|
|
#if defined(__linux__) || defined(__APPLE__)
|
|
|
|
.cfi_startproc
|
|
|
|
#endif
|
|
|
|
|
|
|
|
push %rbp
|
|
|
|
#if defined(__linux__) || defined(__APPLE__)
|
|
|
|
.cfi_def_cfa_offset 16
|
|
|
|
.cfi_offset %rbp, -16
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mov %rsp,%rbp // save rsp
|
|
|
|
|
|
|
|
#if defined(__linux__) || defined(__APPLE__)
|
|
|
|
.cfi_def_cfa_register %rbp
|
|
|
|
#endif
|
|
|
|
|
|
|
|
mov ARG2,%rsp // switch stack
|
|
|
|
call *ARG1 // invoke target address
|
|
|
|
mov %rbp,%rsp
|
|
|
|
pop %rbp
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
#if defined(__linux__) || defined(__APPLE__)
|
|
|
|
.cfi_endproc
|
|
|
|
#endif
|