| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /*
- Copyright Oliver Kowalke 2009.
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt)
- */
- /*****************************************************************************************
- * *
- * ----------------------------------------------------------------------------------- *
- * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
- * ----------------------------------------------------------------------------------- *
- * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
- * ----------------------------------------------------------------------------------- *
- * | EDI | ESI | EBX | EBP | EIP | hidden | to | data | *
- * ----------------------------------------------------------------------------------- *
- * *
- *****************************************************************************************/
- .text
- .globl jump_fcontext
- .align 2
- .type jump_fcontext,@function
- jump_fcontext:
- pushl %ebp /* save EBP */
- pushl %ebx /* save EBX */
- pushl %esi /* save ESI */
- pushl %edi /* save EDI */
- /* store fcontext_t in ECX */
- movl %esp, %ecx
- /* first arg of jump_fcontext() == fcontext to jump to */
- movl 0x18(%esp), %eax
- /* second arg of jump_fcontext() == data to be transferred */
- movl 0x1c(%esp), %edx
- /* restore ESP (pointing to context-data) from EAX */
- movl %eax, %esp
- /* address of returned transport_t */
- movl 0x14(%esp), %eax
- /* return parent fcontext_t */
- movl %ecx, (%eax)
- /* return data */
- movl %edx, 0x4(%eax)
- popl %edi /* restore EDI */
- popl %esi /* restore ESI */
- popl %ebx /* restore EBX */
- popl %ebp /* restore EBP */
- /* jump to context */
- ret $4
- .size jump_fcontext,.-jump_fcontext
- /* Mark that we don't need executable stack. */
- .section .note.GNU-stack,"",%progbits
|