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)
8 /*****************************************************************************************
10 * ----------------------------------------------------------------------------------- *
11 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12 * ----------------------------------------------------------------------------------- *
13 * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
14 * ----------------------------------------------------------------------------------- *
15 * | EDI | ESI | EBX | EBP | EIP | hidden | to | data | *
16 * ----------------------------------------------------------------------------------- *
18 *****************************************************************************************/
24 /* first arg of make_fcontext() == top of context-stack */
27 /* reserve space for first argument of context-function
28 rax might already point to a 16byte border */
31 /* shift address in EAX to lower 16 byte boundary */
34 /* reserve space for context-data on context-stack */
35 leal -0x28(%eax), %eax
37 /* thrid arg of make_fcontext() == address of context-function */
42 /* return transport_t */
43 /* FCTX == EDI, DATA == ESI */
47 /* compute abs address of label trampoline */
49 /* address of trampoline 1 */
51 /* compute abs address of label trampoline */
52 addl $trampoline-1b, %ecx
53 /* save address of trampoline as return address */
54 /* will be entered after calling jump_fcontext() first time */
57 /* compute abs address of label finish */
59 /* address of label 2 */
61 /* compute abs address of label finish */
63 /* save address of finish as return-address for context-function */
64 /* will be entered after context-function returns */
67 ret /* return pointer to context-data */
70 /* move transport_t for entering context-function */
74 /* jump to context-function */
78 /* exit code is zero */
81 /* exit application */