]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.asm
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_x86_64_ms_pe_masm.asm
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 ; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
9 ; ----------------------------------------------------------------------------------
10 ; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
11 ; ----------------------------------------------------------------------------------
12 ; | SEE registers (XMM6-XMM15) |
13 ; ----------------------------------------------------------------------------------
14 ; ----------------------------------------------------------------------------------
15 ; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 ; ----------------------------------------------------------------------------------
17 ; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
18 ; ----------------------------------------------------------------------------------
19 ; | SEE registers (XMM6-XMM15) |
20 ; ----------------------------------------------------------------------------------
21 ; ----------------------------------------------------------------------------------
22 ; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
23 ; ----------------------------------------------------------------------------------
24 ; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
25 ; ----------------------------------------------------------------------------------
26 ; | SEE registers (XMM6-XMM15) |
27 ; ----------------------------------------------------------------------------------
28 ; ----------------------------------------------------------------------------------
29 ; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
30 ; ----------------------------------------------------------------------------------
31 ; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
32 ; ----------------------------------------------------------------------------------
33 ; | SEE registers (XMM6-XMM15) |
34 ; ----------------------------------------------------------------------------------
35 ; ----------------------------------------------------------------------------------
36 ; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
37 ; ----------------------------------------------------------------------------------
38 ; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
39 ; ----------------------------------------------------------------------------------
40 ; | SEE registers (XMM6-XMM15) |
41 ; ----------------------------------------------------------------------------------
42 ; ----------------------------------------------------------------------------------
43 ; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
44 ; ----------------------------------------------------------------------------------
45 ; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
46 ; ----------------------------------------------------------------------------------
47 ; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
48 ; ----------------------------------------------------------------------------------
49 ; ----------------------------------------------------------------------------------
50 ; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
51 ; ----------------------------------------------------------------------------------
52 ; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
53 ; ----------------------------------------------------------------------------------
54 ; | limit | base | R12 | R13 |
55 ; ----------------------------------------------------------------------------------
56 ; ----------------------------------------------------------------------------------
57 ; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
58 ; ----------------------------------------------------------------------------------
59 ; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
60 ; ----------------------------------------------------------------------------------
61 ; | R14 | R15 | RDI | RSI |
62 ; ----------------------------------------------------------------------------------
63 ; ----------------------------------------------------------------------------------
64 ; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
65 ; ----------------------------------------------------------------------------------
66 ; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
67 ; ----------------------------------------------------------------------------------
68 ; | RBX | RBP | hidden | RIP |
69 ; ----------------------------------------------------------------------------------
70 ; ----------------------------------------------------------------------------------
71 ; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
72 ; ----------------------------------------------------------------------------------
73 ; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
74 ; ----------------------------------------------------------------------------------
75 ; | parameter area |
76 ; ----------------------------------------------------------------------------------
77 ; ----------------------------------------------------------------------------------
78 ; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
79 ; ----------------------------------------------------------------------------------
80 ; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
81 ; ----------------------------------------------------------------------------------
82 ; | FCTX | DATA | |
83 ; ----------------------------------------------------------------------------------
84
85 .code
86
87 ontop_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
88 .endprolog
89
90 ; prepare stack
91 lea rsp, [rsp-0118h]
92
93 IFNDEF BOOST_USE_TSX
94 ; save XMM storage
95 movaps [rsp], xmm6
96 movaps [rsp+010h], xmm7
97 movaps [rsp+020h], xmm8
98 movaps [rsp+030h], xmm9
99 movaps [rsp+040h], xmm10
100 movaps [rsp+050h], xmm11
101 movaps [rsp+060h], xmm12
102 movaps [rsp+070h], xmm13
103 movaps [rsp+080h], xmm14
104 movaps [rsp+090h], xmm15
105 ; save MMX control- and status-word
106 stmxcsr [rsp+0a0h]
107 ; save x87 control-word
108 fnstcw [rsp+0a4h]
109 ENDIF
110
111 ; load NT_TIB
112 mov r10, gs:[030h]
113 ; save fiber local storage
114 mov rax, [r10+020h]
115 mov [rsp+0b0h], rax
116 ; save current deallocation stack
117 mov rax, [r10+01478h]
118 mov [rsp+0b8h], rax
119 ; save current stack limit
120 mov rax, [r10+010h]
121 mov [rsp+0c0h], rax
122 ; save current stack base
123 mov rax, [r10+08h]
124 mov [rsp+0c8h], rax
125
126 mov [rsp+0d0h], r12 ; save R12
127 mov [rsp+0d8h], r13 ; save R13
128 mov [rsp+0e0h], r14 ; save R14
129 mov [rsp+0e8h], r15 ; save R15
130 mov [rsp+0f0h], rdi ; save RDI
131 mov [rsp+0f8h], rsi ; save RSI
132 mov [rsp+0100h], rbx ; save RBX
133 mov [rsp+0108h], rbp ; save RBP
134
135 mov [rsp+0110h], rcx ; save hidden address of transport_t
136
137 ; preserve RSP (pointing to context-data) in RCX
138 mov rcx, rsp
139
140 ; restore RSP (pointing to context-data) from RDX
141 mov rsp, rdx
142
143 IFNDEF BOOST_USE_TSX
144 ; restore XMM storage
145 movaps xmm6, [rsp]
146 movaps xmm7, [rsp+010h]
147 movaps xmm8, [rsp+020h]
148 movaps xmm9, [rsp+030h]
149 movaps xmm10, [rsp+040h]
150 movaps xmm11, [rsp+050h]
151 movaps xmm12, [rsp+060h]
152 movaps xmm13, [rsp+070h]
153 movaps xmm14, [rsp+080h]
154 movaps xmm15, [rsp+090h]
155 ; restore MMX control- and status-word
156 ldmxcsr [rsp+0a0h]
157 ; save x87 control-word
158 fldcw [rsp+0a4h]
159 ENDIF
160
161 ; load NT_TIB
162 mov r10, gs:[030h]
163 ; restore fiber local storage
164 mov rax, [rsp+0b0h]
165 mov [r10+020h], rax
166 ; restore current deallocation stack
167 mov rax, [rsp+0b8h]
168 mov [r10+01478h], rax
169 ; restore current stack limit
170 mov rax, [rsp+0c0h]
171 mov [r10+010h], rax
172 ; restore current stack base
173 mov rax, [rsp+0c8h]
174 mov [r10+08h], rax
175
176 mov r12, [rsp+0d0h] ; restore R12
177 mov r13, [rsp+0d8h] ; restore R13
178 mov r14, [rsp+0e0h] ; restore R14
179 mov r15, [rsp+0e8h] ; restore R15
180 mov rdi, [rsp+0f0h] ; restore RDI
181 mov rsi, [rsp+0f8h] ; restore RSI
182 mov rbx, [rsp+0100h] ; restore RBX
183 mov rbp, [rsp+0108h] ; restore RBP
184
185 mov rax, [rsp+0110h] ; restore hidden address of transport_t
186
187 ; prepare stack
188 lea rsp, [rsp+0118h]
189
190 ; keep return-address on stack
191
192 ; transport_t returned in RAX
193 ; return parent fcontext_t
194 mov [rax], rcx
195 ; return data
196 mov [rax+08h], r8
197
198 ; transport_t as 1.arg of context-function
199 ; RCX contains address of returned (hidden) transfer_t
200 mov rcx, rax
201 ; RDX contains address of passed transfer_t
202 mov rdx, rax
203
204 ; indirect jump to context
205 jmp r9
206 ontop_fcontext ENDP
207 END