]>
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 | ||
b32b8144 FG |
8 | /**************************************************************************************** |
9 | * * | |
10 | * ---------------------------------------------------------------------------------- * | |
11 | * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | * | |
12 | * ---------------------------------------------------------------------------------- * | |
13 | * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | * | |
14 | * ---------------------------------------------------------------------------------- * | |
15 | * | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | hidden | * | |
16 | * ---------------------------------------------------------------------------------- * | |
17 | * ---------------------------------------------------------------------------------- * | |
18 | * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | * | |
19 | * ---------------------------------------------------------------------------------- * | |
20 | * | 0x20 | 0x24 | | * | |
21 | * ---------------------------------------------------------------------------------- * | |
22 | * | to | data | | * | |
23 | * ---------------------------------------------------------------------------------- * | |
24 | * * | |
25 | ****************************************************************************************/ | |
7c673cae FG |
26 | |
27 | .text | |
28 | .globl jump_fcontext | |
29 | .align 2 | |
30 | .type jump_fcontext,@function | |
31 | jump_fcontext: | |
b32b8144 | 32 | leal -0x18(%esp), %esp /* prepare stack */ |
7c673cae | 33 | |
b32b8144 FG |
34 | #if !defined(BOOST_USE_TSX) |
35 | stmxcsr (%esp) /* save MMX control- and status-word */ | |
36 | fnstcw 0x4(%esp) /* save x87 control-word */ | |
37 | #endif | |
38 | ||
39 | movl %edi, 0x8(%esp) /* save EDI */ | |
40 | movl %esi, 0xc(%esp) /* save ESI */ | |
41 | movl %ebx, 0x10(%esp) /* save EBX */ | |
42 | movl %ebp, 0x14(%esp) /* save EBP */ | |
43 | ||
44 | /* store ESP (pointing to context-data) in ECX */ | |
7c673cae FG |
45 | movl %esp, %ecx |
46 | ||
47 | /* first arg of jump_fcontext() == fcontext to jump to */ | |
b32b8144 | 48 | movl 0x20(%esp), %eax |
7c673cae FG |
49 | |
50 | /* second arg of jump_fcontext() == data to be transferred */ | |
b32b8144 | 51 | movl 0x24(%esp), %edx |
7c673cae FG |
52 | |
53 | /* restore ESP (pointing to context-data) from EAX */ | |
54 | movl %eax, %esp | |
55 | ||
56 | /* address of returned transport_t */ | |
b32b8144 | 57 | movl 0x1c(%esp), %eax |
7c673cae FG |
58 | /* return parent fcontext_t */ |
59 | movl %ecx, (%eax) | |
60 | /* return data */ | |
61 | movl %edx, 0x4(%eax) | |
62 | ||
b32b8144 FG |
63 | movl 0x18(%esp), %ecx /* restore EIP */ |
64 | ||
65 | #if !defined(BOOST_USE_TSX) | |
66 | ldmxcsr (%esp) /* restore MMX control- and status-word */ | |
67 | fldcw 0x4(%esp) /* restore x87 control-word */ | |
68 | #endif | |
69 | ||
70 | movl 0x8(%esp), %edi /* restore EDI */ | |
71 | movl 0xc(%esp), %esi /* restore ESI */ | |
72 | movl 0x10(%esp), %ebx /* restore EBX */ | |
73 | movl 0x14(%esp), %ebp /* restore EBP */ | |
74 | ||
75 | leal 0x20(%esp), %esp /* prepare stack */ | |
7c673cae FG |
76 | |
77 | /* jump to context */ | |
b32b8144 | 78 | jmp *%ecx |
7c673cae FG |
79 | .size jump_fcontext,.-jump_fcontext |
80 | ||
81 | /* Mark that we don't need executable stack. */ | |
82 | .section .note.GNU-stack,"",%progbits |