]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/src/asm/ontop_i386_ms_pe_gas.asm
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_i386_ms_pe_gas.asm
CommitLineData
7c673cae
FG
1/*
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)
7*/
8
9/*************************************************************************************
10* --------------------------------------------------------------------------------- *
11* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12* --------------------------------------------------------------------------------- *
13* | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch | *
14* --------------------------------------------------------------------------------- *
b32b8144 15* | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI | *
7c673cae
FG
16* --------------------------------------------------------------------------------- *
17* --------------------------------------------------------------------------------- *
18* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19* --------------------------------------------------------------------------------- *
20* | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | *
21* --------------------------------------------------------------------------------- *
b32b8144 22* | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR| *
7c673cae 23* --------------------------------------------------------------------------------- *
b32b8144 24**************************************************************************************/
7c673cae
FG
25
26.file "ontop_i386_ms_pe_gas.asm"
27.text
28.p2align 4,,15
29.globl _ontop_fcontext
30.def _ontop_fcontext; .scl 2; .type 32; .endef
31_ontop_fcontext:
b32b8144
FG
32 /* prepare stack */
33 leal -0x2c(%esp), %esp
34
35#if !defined(BOOST_USE_TSX)
36 /* save MMX control- and status-word */
37 stmxcsr (%esp)
38 /* save x87 control-word */
39 fnstcw 0x4(%esp)
40#endif
7c673cae
FG
41
42 /* load NT_TIB */
43 movl %fs:(0x18), %edx
b32b8144
FG
44 /* load fiber local storage */
45 movl 0x10(%edx), %eax
46 movl %eax, 0x8(%esp)
47 /* load current dealloction stack */
48 movl 0xe0c(%edx), %eax
49 movl %eax, 0xc(%esp)
50 /* load current stack limit */
51 movl 0x8(%edx), %eax
52 movl %eax, 0x10(%esp)
53 /* load current stack base */
54 movl 0x4(%edx), %eax
55 movl %eax, 0x14(%esp)
7c673cae
FG
56 /* load current SEH exception list */
57 movl (%edx), %eax
b32b8144 58 movl %eax, 0x18(%esp)
7c673cae 59
b32b8144
FG
60 movl %edi, 0x1c(%esp) /* save EDI */
61 movl %esi, 0x20(%esp) /* save ESI */
62 movl %ebx, 0x24(%esp) /* save EBX */
63 movl %ebp, 0x28(%esp) /* save EBP */
7c673cae 64
b32b8144 65 /* store ESP (pointing to context-data) in ECX */
7c673cae
FG
66 movl %esp, %ecx
67
68 /* first arg of ontop_fcontext() == fcontext to jump to */
b32b8144 69 movl 0x30(%esp), %eax
7c673cae
FG
70
71 /* pass parent fcontext_t */
b32b8144 72 movl %ecx, 0x30(%eax)
7c673cae
FG
73
74 /* second arg of ontop_fcontext() == data to be transferred */
b32b8144 75 movl 0x34(%esp), %ecx
7c673cae
FG
76
77 /* pass data */
b32b8144 78 movl %ecx, 0x34(%eax)
7c673cae
FG
79
80 /* third arg of ontop_fcontext() == ontop-function */
b32b8144 81 movl 0x38(%esp), %ecx
7c673cae
FG
82
83 /* restore ESP (pointing to context-data) from EDX */
84 movl %eax, %esp
85
b32b8144
FG
86#if !defined(BOOST_USE_TSX)
87 /* restore MMX control- and status-word */
88 ldmxcsr (%esp)
89 /* restore x87 control-word */
90 fldcw 0x4(%esp)
91#endif
7c673cae 92
b32b8144
FG
93 /* restore NT_TIB into EDX */
94 movl %fs:(0x18), %edx
7c673cae 95 /* restore fiber local storage */
b32b8144 96 movl 0x8(%esp), %eax
7c673cae 97 movl %eax, 0x10(%edx)
7c673cae 98 /* restore current deallocation stack */
b32b8144 99 movl 0xc(%esp), %eax
7c673cae 100 movl %eax, 0xe0c(%edx)
7c673cae 101 /* restore current stack limit */
b32b8144 102 movl 0x10(%esp), %eax
7c673cae 103 movl %eax, 0x08(%edx)
7c673cae 104 /* restore current stack base */
b32b8144 105 movl 0x14(%esp), %eax
7c673cae 106 movl %eax, 0x04(%edx)
7c673cae 107 /* restore current SEH exception list */
b32b8144 108 movl 0x18(%esp), %eax
7c673cae
FG
109 movl %eax, (%edx)
110
b32b8144
FG
111 movl 0x1c(%esp), %edi /* restore EDI */
112 movl 0x20(%esp), %esi /* restore ESI */
113 movl 0x24(%esp), %ebx /* restore EBX */
114 movl 0x28(%esp), %ebp /* restore EBP */
115
116 /* prepare stack */
117 leal 0x2c(%esp), %esp
118
119 /* keep return-address on stack */
7c673cae
FG
120
121 /* jump to context */
122 jmp *%ecx
123
124.section .drectve
125.ascii " -export:\"ontop_fcontext\""