2 Copyright Oliver Kowalke 2009.
3 Copyright Thomas Sailer 2013.
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE_1_0.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
9 /*************************************************************************************
10 * --------------------------------------------------------------------------------- *
11 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12 * --------------------------------------------------------------------------------- *
13 * | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch | *
14 * --------------------------------------------------------------------------------- *
15 * | fc_strg |fc_deallo| limit | base | fc_seh | EDI | ESI | EBX | *
16 * --------------------------------------------------------------------------------- *
17 * --------------------------------------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * --------------------------------------------------------------------------------- *
20 * | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | *
21 * --------------------------------------------------------------------------------- *
22 * | EBP | EIP | to | data | | EH NXT |SEH HNDLR| | *
23 * --------------------------------------------------------------------------------- *
24 *************************************************************************************/
26 .file "jump_i386_ms_pe_gas.asm"
30 .def _jump_fcontext; .scl 2; .type 32; .endef
32 pushl %ebp /* save EBP */
33 pushl %ebx /* save EBX */
34 pushl %esi /* save ESI */
35 pushl %edi /* save EDI */
40 /* load current SEH exception list */
44 /* load current stack base */
48 /* load current stack limit */
52 /* load current dealloction stack */
53 movl 0xe0c(%edx), %eax
56 /* load fiber local storage */
60 /* store ESP (pointing to context-data) in EAX */
63 /* first arg of jump_fcontext() == fcontext to jump to */
66 /* restore ESP (pointing to context-data) from EDX */
69 /* load NT_TIB into ECX */
72 /* restore fiber local storage */
76 /* restore current deallocation stack */
78 movl %ecx, 0xe0c(%edx)
80 /* restore current stack limit */
84 /* restore current stack base */
88 /* restore current SEH exception list */
92 popl %edi /* save EDI */
93 popl %esi /* save ESI */
94 popl %ebx /* save EBX */
95 popl %ebp /* save EBP */
97 /* return transfer_t */
98 /* FCTX == EAX, DATA == EDX */
101 /* jump to context */
105 .ascii " -export:\"jump_fcontext\""