]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | Copyright Oliver Kowalke 2009. | |
3 | Distributed under the Boost Software License, Version 1.0. | |
4 | (See accompanying file LICENSE_1_0.txt or copy at | |
5 | http://www.boost.org/LICENSE_1_0.txt) | |
6 | */ | |
7 | ||
8 | /***************************************************************************************** | |
9 | * * | |
10 | * ----------------------------------------------------------------------------------- * | |
11 | * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | |
12 | * ----------------------------------------------------------------------------------- * | |
13 | * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | * | |
14 | * ----------------------------------------------------------------------------------- * | |
15 | * | EDI | ESI | EBX | EBP | EIP | hidden | to | data | * | |
16 | * ----------------------------------------------------------------------------------- * | |
17 | * * | |
18 | *****************************************************************************************/ | |
19 | ||
20 | .text | |
21 | .globl jump_fcontext | |
22 | .align 2 | |
23 | .type jump_fcontext,@function | |
24 | jump_fcontext: | |
25 | pushl %ebp /* save EBP */ | |
26 | pushl %ebx /* save EBX */ | |
27 | pushl %esi /* save ESI */ | |
28 | pushl %edi /* save EDI */ | |
29 | ||
30 | /* store fcontext_t in ECX */ | |
31 | movl %esp, %ecx | |
32 | ||
33 | /* first arg of jump_fcontext() == fcontext to jump to */ | |
34 | movl 0x18(%esp), %eax | |
35 | ||
36 | /* second arg of jump_fcontext() == data to be transferred */ | |
37 | movl 0x1c(%esp), %edx | |
38 | ||
39 | /* restore ESP (pointing to context-data) from EAX */ | |
40 | movl %eax, %esp | |
41 | ||
42 | /* address of returned transport_t */ | |
43 | movl 0x14(%esp), %eax | |
44 | /* return parent fcontext_t */ | |
45 | movl %ecx, (%eax) | |
46 | /* return data */ | |
47 | movl %edx, 0x4(%eax) | |
48 | ||
49 | popl %edi /* restore EDI */ | |
50 | popl %esi /* restore ESI */ | |
51 | popl %ebx /* restore EBX */ | |
52 | popl %ebp /* restore EBP */ | |
53 | ||
54 | /* jump to context */ | |
55 | ret $4 | |
56 | .size jump_fcontext,.-jump_fcontext | |
57 | ||
58 | /* Mark that we don't need executable stack. */ | |
59 | .section .note.GNU-stack,"",%progbits |