]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/jump_i386_ms_pe_masm.asm
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / jump_i386_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 ; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
11 ; ---------------------------------------------------------------------------------
12 ; | fc_strg |fc_deallo| limit | base | fc_seh | EDI | ESI | EBX |
13 ; ---------------------------------------------------------------------------------
14 ; ---------------------------------------------------------------------------------
15 ; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 ; ---------------------------------------------------------------------------------
17 ; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
18 ; ---------------------------------------------------------------------------------
19 ; | EBP | EIP | to | data | | EH NXT |SEH HNDLR| |
20 ; ---------------------------------------------------------------------------------
21
22 .386
23 .XMM
24 .model flat, c
25 .code
26
27 jump_fcontext PROC BOOST_CONTEXT_EXPORT
28 push ebp ; save EBP
29 push ebx ; save EBX
30 push esi ; save ESI
31 push edi ; save EDI
32
33 assume fs:nothing
34 ; load NT_TIB into ECX
35 mov edx, fs:[018h]
36 assume fs:error
37
38 ; load current SEH exception list
39 mov eax, [edx]
40 push eax
41
42 ; load current stack base
43 mov eax, [edx+04h]
44 push eax
45
46 ; load current stack limit
47 mov eax, [edx+08h]
48 push eax
49
50 ; load current deallocation stack
51 mov eax, [edx+0e0ch]
52 push eax
53
54 ; load fiber local storage
55 mov eax, [edx+010h]
56 push eax
57
58 ; store ESP (pointing to context-data) in EAX
59 mov eax, esp
60
61 ; firstarg of jump_fcontext() == fcontext to jump to
62 mov ecx, [esp+028h]
63
64 ; restore ESP (pointing to context-data) from EAX
65 mov esp, ecx
66
67 assume fs:nothing
68 ; load NT_TIB into EDX
69 mov edx, fs:[018h]
70 assume fs:error
71
72 ; restore fiber local storage
73 pop ecx
74 mov [edx+010h], ecx
75
76 ; restore current deallocation stack
77 pop ecx
78 mov [edx+0e0ch], ecx
79
80 ; restore current stack limit
81 pop ecx
82 mov [edx+08h], ecx
83
84 ; restore current stack base
85 pop ecx
86 mov [edx+04h], ecx
87
88 ; restore current SEH exception list
89 pop ecx
90 mov [edx], ecx
91
92 pop edi ; save EDI
93 pop esi ; save ESI
94 pop ebx ; save EBX
95 pop ebp ; save EBP
96
97 ; return transfer_t
98 ; FCTX == EAX, DATA == EDX
99 mov edx, [eax+02ch]
100
101 ; jump to context
102 ret
103 jump_fcontext ENDP
104 END