]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / jump_x86_64_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 * ---------------------------------------------------------------------------------- *
12 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
13 * ---------------------------------------------------------------------------------- *
14 * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
15 * ---------------------------------------------------------------------------------- *
16 * | fbr_strg | fc_dealloc | limit | base | *
17 * ---------------------------------------------------------------------------------- *
18 * ---------------------------------------------------------------------------------- *
19 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
20 * ---------------------------------------------------------------------------------- *
21 * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
22 * ---------------------------------------------------------------------------------- *
23 * | R12 | R13 | R14 | R15 | *
24 * ---------------------------------------------------------------------------------- *
25 * ---------------------------------------------------------------------------------- *
26 * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
27 * ---------------------------------------------------------------------------------- *
28 * | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
29 * ---------------------------------------------------------------------------------- *
30 * | RDI | RSI | RBX | RBP | *
31 * ---------------------------------------------------------------------------------- *
32 * ---------------------------------------------------------------------------------- *
33 * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
34 * ---------------------------------------------------------------------------------- *
35 * | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
36 * ---------------------------------------------------------------------------------- *
37 * | hidden | RIP | EXIT | parameter area | *
38 * ---------------------------------------------------------------------------------- *
39 * ---------------------------------------------------------------------------------- *
40 * | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
41 * ---------------------------------------------------------------------------------- *
42 * | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
43 * ---------------------------------------------------------------------------------- *
44 * | parameter area | FCTX | *
45 * ---------------------------------------------------------------------------------- *
46 * ---------------------------------------------------------------------------------- *
47 * | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
48 * ---------------------------------------------------------------------------------- *
49 * | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
50 * ---------------------------------------------------------------------------------- *
51 * | DATA | | | | *
52 * ---------------------------------------------------------------------------------- *
53 * *
54 * ***********************************************************************************/
55
56 .file "jump_x86_64_ms_pe_gas.asm"
57 .text
58 .p2align 4,,15
59 .globl jump_fcontext
60 .def jump_fcontext; .scl 2; .type 32; .endef
61 .seh_proc jump_fcontext
62 jump_fcontext:
63 .seh_endprologue
64
65 pushq %rcx /* save hidden address of transport_t */
66
67 pushq %rbp /* save RBP */
68 pushq %rbx /* save RBX */
69 pushq %rsi /* save RSI */
70 pushq %rdi /* save RDI */
71 pushq %r15 /* save R15 */
72 pushq %r14 /* save R14 */
73 pushq %r13 /* save R13 */
74 pushq %r12 /* save R12 */
75
76 /* load NT_TIB */
77 movq %gs:(0x30), %r10
78 /* save current stack base */
79 movq 0x08(%r10), %rax
80 pushq %rax
81 /* save current stack limit */
82 movq 0x10(%r10), %rax
83 pushq %rax
84 /* save current deallocation stack */
85 movq 0x1478(%r10), %rax
86 pushq %rax
87 /* save fiber local storage */
88 movq 0x18(%r10), %rax
89 pushq %rax
90
91 /* preserve RSP (pointing to context-data) in R9 */
92 movq %rsp, %r9
93
94 /* restore RSP (pointing to context-data) from RDX */
95 movq %rdx, %rsp
96
97 /* load NT_TIB */
98 movq %gs:(0x30), %r10
99 /* restore fiber local storage */
100 popq %rax
101 movq %rax, 0x18(%r10)
102 /* restore deallocation stack */
103 popq %rax
104 movq %rax, 0x1478(%r10)
105 /* restore stack limit */
106 popq %rax
107 movq %rax, 0x10(%r10)
108 /* restore stack base */
109 popq %rax
110 movq %rax, 0x8(%r10)
111
112 popq %r12 /* restore R12 */
113 popq %r13 /* restore R13 */
114 popq %r14 /* restore R14 */
115 popq %r15 /* restore R15 */
116 popq %rdi /* restore RDI */
117 popq %rsi /* restore RSI */
118 popq %rbx /* restore RBX */
119 popq %rbp /* restore RBP */
120
121 popq %rax /* restore hidden address of transport_t */
122
123 /* restore return-address */
124 popq %r10
125
126 /* transport_t returned in RAX */
127 /* return parent fcontext_t */
128 movq %r9, (%rax)
129 /* return data */
130 movq %r8, 0x8(%rax)
131
132 /* transport_t as 1.arg of context-function */
133 movq %rax, %rcx
134
135 /* indirect jump to context */
136 jmp *%r10
137 .seh_endproc
138
139 .section .drectve
140 .ascii " -export:\"jump_fcontext\""