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