]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/ontop_i386_sysv_macho_gas.S
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_i386_sysv_macho_gas.S
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
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 ****************************************************************************************/
26
27 .text
28 .globl _ontop_fcontext
29 .align 2
30 _ontop_fcontext:
31 leal -0x18(%esp), %esp /* prepare stack */
32
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 */
44 movl %esp, %ecx
45
46 /* first arg of ontop_fcontext() == fcontext to jump to */
47 movl 0x1c(%esp), %eax
48
49 /* pass parent fcontext_t */
50 movl %ecx, 0x1c(%eax)
51
52 /* second arg of ontop_fcontext() == data to be transferred */
53 movl 0x20(%esp), %ecx
54
55 /* pass data */
56 movl %ecx, 0x20(%eax)
57
58 /* third arg of ontop_fcontext() == ontop-function */
59 movl 0x24(%esp), %ecx
60
61 /* restore ESP (pointing to context-data) from EAX */
62 movl %eax, %esp
63
64 /* return parent fcontext_t */
65 movl %ecx, %eax
66 /* returned data is stored in EDX */
67
68 #if !defined(BOOST_USE_TSX)
69 ldmxcsr (%esp) /* restore MMX control- and status-word */
70 fldcw 0x4(%esp) /* restore x87 control-word */
71 #endif
72
73 movl 0x8(%esp), %edi /* restore EDI */
74 movl 0xc(%esp), %esi /* restore ESI */
75 movl 0x10(%esp), %ebx /* restore EBX */
76 movl 0x14(%esp), %ebp /* restore EBP */
77
78 leal 0x18(%esp), %esp /* prepare stack */
79
80 /* jump to context */
81 jmp *%ecx