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 * | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | hidden | *
16 * ---------------------------------------------------------------------------------- *
17 * ---------------------------------------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * ---------------------------------------------------------------------------------- *
21 * ---------------------------------------------------------------------------------- *
23 * ---------------------------------------------------------------------------------- *
25 ****************************************************************************************/
30 .type make_fcontext,@function
32 /* first arg of make_fcontext() == top of context-stack */
35 /* reserve space for first argument of context-function
36 eax might already point to a 16byte border */
39 /* shift address in EAX to lower 16 byte boundary */
42 /* reserve space for context-data on context-stack */
43 leal -0x28(%eax), %eax
45 /* third arg of make_fcontext() == address of context-function */
50 /* save MMX control- and status-word */
52 /* save x87 control-word */
55 /* return transport_t */
56 /* FCTX == EDI, DATA == ESI */
60 /* compute abs address of label trampoline */
62 /* address of trampoline 1 */
64 /* compute abs address of label trampoline */
65 addl $trampoline-1b, %ecx
66 /* save address of trampoline as return address */
67 /* will be entered after calling jump_fcontext() first time */
70 /* compute abs address of label finish */
72 /* address of label 2 */
74 /* compute abs address of label finish */
76 /* save address of finish as return-address for context-function */
77 /* will be entered after context-function returns */
80 ret /* return pointer to context-data */
83 /* move transport_t for entering context-function */
87 /* jump to context-function */
92 /* address of label 3 */
94 /* compute address of GOT and store it in EBX */
95 addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
97 /* exit code is zero */
100 /* exit application */
103 .size make_fcontext,.-make_fcontext
105 /* Mark that we don't need executable stack. */
106 .section .note.GNU-stack,"",%progbits