]>
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 ontop_fcontext | |
29 | .align 2 | |
30 | .type ontop_fcontext,@function | |
31 | ontop_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 ontop_fcontext() == fcontext to jump to */ | |
b32b8144 | 48 | movl 0x20(%esp), %eax |
7c673cae FG |
49 | |
50 | /* pass parent fcontext_t */ | |
b32b8144 | 51 | movl %ecx, 0x20(%eax) |
7c673cae FG |
52 | |
53 | /* second arg of ontop_fcontext() == data to be transferred */ | |
b32b8144 | 54 | movl 0x24(%esp), %ecx |
7c673cae FG |
55 | |
56 | /* pass data */ | |
b32b8144 | 57 | movl %ecx, 0x24(%eax) |
7c673cae FG |
58 | |
59 | /* third arg of ontop_fcontext() == ontop-function */ | |
b32b8144 | 60 | movl 0x28(%esp), %ecx |
7c673cae | 61 | |
b32b8144 | 62 | /* restore ESP (pointing to context-data) from EAX */ |
7c673cae FG |
63 | movl %eax, %esp |
64 | ||
b32b8144 FG |
65 | /* address of returned transport_t */ |
66 | movl 0x1c(%esp), %eax | |
67 | /* return parent fcontext_t */ | |
68 | movl %ecx, (%eax) | |
69 | /* return data */ | |
70 | movl %edx, 0x4(%eax) | |
71 | ||
72 | #if !defined(BOOST_USE_TSX) | |
73 | ldmxcsr (%esp) /* restore MMX control- and status-word */ | |
74 | fldcw 0x4(%esp) /* restore x87 control-word */ | |
75 | #endif | |
76 | ||
77 | movl 0x8(%esp), %edi /* restore EDI */ | |
78 | movl 0xc(%esp), %esi /* restore ESI */ | |
79 | movl 0x10(%esp), %ebx /* restore EBX */ | |
80 | movl 0x14(%esp), %ebp /* restore EBP */ | |
81 | ||
82 | leal 0x18(%esp), %esp /* prepare stack */ | |
7c673cae FG |
83 | |
84 | /* jump to context */ | |
85 | jmp *%ecx | |
86 | .size ontop_fcontext,.-ontop_fcontext | |
87 | ||
88 | /* Mark that we don't need executable stack. */ | |
89 | .section .note.GNU-stack,"",%progbits |