rt: Add DWARF CFI info to asm_call_on_stack

This will allow the unwinder to unwind this function so we can call
upcall_fail on the C stack.
This commit is contained in:
Brian Anderson 2011-12-11 13:38:04 -08:00
parent 4699b6865f
commit 5cd08586f6
2 changed files with 57 additions and 16 deletions

View File

@ -7,12 +7,33 @@ _asm_call_on_stack:
.globl asm_call_on_stack
asm_call_on_stack:
#endif
pushl %ebp
movl %esp,%ebp // save esp
movl 16(%ebp),%esp // load new esp
subl $12,%esp // maintain 16-byte alignment
pushl 8(%ebp) // push ptr to argument block
calll *12(%ebp)
movl %ebp,%esp // would like to use "leave" but it's slower
popl %ebp
ret
#if defined(__linux__) || defined(__APPLE__)
.cfi_startproc
#endif
pushl %ebp
#if defined(__linux__) || defined(__APPLE__)
.cfi_def_cfa_offset 8
.cfi_offset %ebp, -8
#endif
movl %esp,%ebp // save esp
#if defined(__linux__) || defined(__APPLE__)
.cfi_def_cfa_register %ebp
#endif
movl 16(%ebp),%esp // load new esp
subl $12,%esp // maintain 16-byte alignment
pushl 8(%ebp) // push ptr to argument block
calll *12(%ebp)
movl %ebp,%esp // would like to use "leave" but it's slower
popl %ebp
ret
#if defined(__linux__) || defined(__APPLE__)
.cfi_endproc
#endif

View File

@ -13,10 +13,30 @@ _asm_call_on_stack:
.globl asm_call_on_stack
asm_call_on_stack:
#endif
push %rbp
mov %rsp,%rbp // save rsp
mov ARG2,%rsp // switch stack
call *ARG1 // invoke target address
mov %rbp,%rsp
pop %rbp
ret
#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