]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.asm
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_i386_ms_pe_masm.asm
CommitLineData
7c673cae
FG
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; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
11; ---------------------------------------------------------------------------------
b32b8144 12; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
7c673cae
FG
13; ---------------------------------------------------------------------------------
14; ---------------------------------------------------------------------------------
15; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16; ---------------------------------------------------------------------------------
17; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
18; ---------------------------------------------------------------------------------
b32b8144 19; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
7c673cae
FG
20; ---------------------------------------------------------------------------------
21
22.386
23.XMM
24.model flat, c
25.code
26
27ontop_fcontext PROC BOOST_CONTEXT_EXPORT
b32b8144
FG
28 ; prepare stack
29 lea esp, [esp-02ch]
30
31IFNDEF BOOST_USE_TSX
32 ; save MMX control- and status-word
33 stmxcsr [esp]
34 ; save x87 control-word
35 fnstcw [esp+04h]
36ENDIF
7c673cae
FG
37
38 assume fs:nothing
b32b8144 39 ; load NT_TIB into ECX
7c673cae
FG
40 mov edx, fs:[018h]
41 assume fs:error
b32b8144
FG
42 ; load fiber local storage
43 mov eax, [edx+010h]
44 mov [esp+08h], eax
7c673cae
FG
45 ; load current deallocation stack
46 mov eax, [edx+0e0ch]
b32b8144
FG
47 mov [esp+0ch], eax
48 ; load current stack limit
49 mov eax, [edx+08h]
50 mov [esp+010h], eax
51 ; load current stack base
52 mov eax, [edx+04h]
53 mov [esp+014h], eax
54 ; load current SEH exception list
55 mov eax, [edx]
56 mov [esp+018h], eax
7c673cae 57
b32b8144
FG
58 mov [esp+01ch], edi ; save EDI
59 mov [esp+020h], esi ; save ESI
60 mov [esp+024h], ebx ; save EBX
61 mov [esp+028h], ebp ; save EBP
7c673cae
FG
62
63 ; store ESP (pointing to context-data) in ECX
64 mov ecx, esp
65
66 ; first arg of ontop_fcontext() == fcontext to jump to
b32b8144 67 mov eax, [esp+030h]
7c673cae
FG
68
69 ; pass parent fcontext_t
b32b8144 70 mov [eax+030h], ecx
7c673cae
FG
71
72 ; second arg of ontop_fcontext() == data to be transferred
b32b8144 73 mov ecx, [esp+034h]
7c673cae
FG
74
75 ; pass data
b32b8144 76 mov [eax+034h], ecx
7c673cae
FG
77
78 ; third arg of ontop_fcontext() == ontop-function
b32b8144 79 mov ecx, [esp+038h]
7c673cae
FG
80
81 ; restore ESP (pointing to context-data) from EAX
82 mov esp, eax
83
b32b8144
FG
84IFNDEF BOOST_USE_TSX
85 ; restore MMX control- and status-word
86 ldmxcsr [esp]
87 ; restore x87 control-word
88 fldcw [esp+04h]
89ENDIF
90
7c673cae
FG
91 assume fs:nothing
92 ; load NT_TIB into EDX
93 mov edx, fs:[018h]
94 assume fs:error
7c673cae 95 ; restore fiber local storage
b32b8144 96 mov eax, [esp+08h]
7c673cae 97 mov [edx+010h], eax
7c673cae 98 ; restore current deallocation stack
b32b8144 99 mov eax, [esp+0ch]
7c673cae 100 mov [edx+0e0ch], eax
7c673cae 101 ; restore current stack limit
b32b8144 102 mov eax, [esp+010h]
7c673cae 103 mov [edx+08h], eax
7c673cae 104 ; restore current stack base
b32b8144 105 mov eax, [esp+014h]
7c673cae 106 mov [edx+04h], eax
7c673cae 107 ; restore current SEH exception list
b32b8144 108 mov eax, [esp+018h]
7c673cae
FG
109 mov [edx], eax
110
b32b8144
FG
111 mov edi, [esp+01ch] ; restore EDI
112 mov esi, [esp+020h] ; restore ESI
113 mov ebx, [esp+024h] ; restore EBX
114 mov ebp, [esp+028h] ; restore EBP
115
116 ; prepare stack
117 lea esp, [esp+02ch]
118
119 ; keep return-address on stack
7c673cae
FG
120
121 ; jump to context
122 jmp ecx
123ontop_fcontext ENDP
124END