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