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)
7 ; ---------------------------------------------------------------------------------
8 ; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
9 ; ---------------------------------------------------------------------------------
10 ; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
11 ; ---------------------------------------------------------------------------------
12 ; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
13 ; ---------------------------------------------------------------------------------
14 ; ---------------------------------------------------------------------------------
15 ; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 ; ---------------------------------------------------------------------------------
17 ; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
18 ; ---------------------------------------------------------------------------------
19 ; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
20 ; ---------------------------------------------------------------------------------
27 jump_fcontext PROC BOOST_CONTEXT_EXPORT
32 ; save MMX control- and status-word
34 ; save x87 control-word
39 ; load NT_TIB into ECX
42 ; load fiber local storage
45 ; load current deallocation stack
48 ; load current stack limit
51 ; load current stack base
54 ; load current SEH exception list
58 mov [esp+01ch], edi ; save EDI
59 mov [esp+020h], esi ; save ESI
60 mov [esp+024h], ebx ; save EBX
61 mov [esp+028h], ebp ; save EBP
63 ; store ESP (pointing to context-data) in EAX
66 ; firstarg of jump_fcontext() == fcontext to jump to
69 ; restore ESP (pointing to context-data) from ECX
73 ; restore MMX control- and status-word
75 ; restore x87 control-word
80 ; load NT_TIB into EDX
83 ; restore fiber local storage
86 ; restore current deallocation stack
89 ; restore current stack limit
92 ; restore current stack base
95 ; restore current SEH exception list
99 mov ecx, [esp+02ch] ; restore EIP
101 mov edi, [esp+01ch] ; restore EDI
102 mov esi, [esp+020h] ; restore ESI
103 mov ebx, [esp+024h] ; restore EBX
104 mov ebp, [esp+028h] ; restore EBP
110 ; FCTX == EAX, DATA == EDX