]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/jump_i386_ms_pe_gas.asm
8c44a73bbad845f182c0b8267f00b3820be18b90
[ceph.git] / ceph / src / boost / libs / context / src / asm / jump_i386_ms_pe_gas.asm
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 * --------------------------------------------------------------------------------- *
15 * | fc_strg |fc_deallo| limit | base | fc_seh | EDI | ESI | EBX | *
16 * --------------------------------------------------------------------------------- *
17 * --------------------------------------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * --------------------------------------------------------------------------------- *
20 * | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | *
21 * --------------------------------------------------------------------------------- *
22 * | EBP | EIP | to | data | | EH NXT |SEH HNDLR| | *
23 * --------------------------------------------------------------------------------- *
24 *************************************************************************************/
25
26 .file "jump_i386_ms_pe_gas.asm"
27 .text
28 .p2align 4,,15
29 .globl _jump_fcontext
30 .def _jump_fcontext; .scl 2; .type 32; .endef
31 _jump_fcontext:
32 pushl %ebp /* save EBP */
33 pushl %ebx /* save EBX */
34 pushl %esi /* save ESI */
35 pushl %edi /* save EDI */
36
37 /* load NT_TIB */
38 movl %fs:(0x18), %edx
39
40 /* load current SEH exception list */
41 movl (%edx), %eax
42 push %eax
43
44 /* load current stack base */
45 movl 0x04(%edx), %eax
46 push %eax
47
48 /* load current stack limit */
49 movl 0x08(%edx), %eax
50 push %eax
51
52 /* load current dealloction stack */
53 movl 0xe0c(%edx), %eax
54 push %eax
55
56 /* load fiber local storage */
57 movl 0x10(%edx), %eax
58 push %eax
59
60 /* store ESP (pointing to context-data) in EAX */
61 movl %esp, %eax
62
63 /* first arg of jump_fcontext() == fcontext to jump to */
64 movl 0x28(%esp), %ecx
65
66 /* restore ESP (pointing to context-data) from EDX */
67 movl %ecx, %esp
68
69 /* load NT_TIB into ECX */
70 movl %fs:(0x18), %edx
71
72 /* restore fiber local storage */
73 popl %ecx
74 movl %ecx, 0x10(%edx)
75
76 /* restore current deallocation stack */
77 popl %ecx
78 movl %ecx, 0xe0c(%edx)
79
80 /* restore current stack limit */
81 popl %ecx
82 movl %ecx, 0x08(%edx)
83
84 /* restore current stack base */
85 popl %ecx
86 movl %ecx, 0x04(%edx)
87
88 /* restore current SEH exception list */
89 popl %ecx
90 movl %ecx, (%edx)
91
92 popl %edi /* save EDI */
93 popl %esi /* save ESI */
94 popl %ebx /* save EBX */
95 popl %ebp /* save EBP */
96
97 /* return transfer_t */
98 /* FCTX == EAX, DATA == EDX */
99 movl 0x2c(%eax), %edx
100
101 /* jump to context */
102 ret
103
104 .section .drectve
105 .ascii " -export:\"jump_fcontext\""