]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_ppc64_sysv_elf_gas.S
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/*******************************************************
9 * *
10 * ------------------------------------------------- *
11 * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
12 * ------------------------------------------------- *
13 * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
14 * ------------------------------------------------- *
15 * | TOC | R14 | R15 | R16 | *
16 * ------------------------------------------------- *
17 * ------------------------------------------------- *
18 * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
19 * ------------------------------------------------- *
20 * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
21 * ------------------------------------------------- *
22 * | R17 | R18 | R19 | R20 | *
23 * ------------------------------------------------- *
24 * ------------------------------------------------- *
25 * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
26 * ------------------------------------------------- *
27 * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
28 * ------------------------------------------------- *
29 * | R21 | R22 | R23 | R24 | *
30 * ------------------------------------------------- *
31 * ------------------------------------------------- *
32 * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
33 * ------------------------------------------------- *
34 * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
35 * ------------------------------------------------- *
36 * | R25 | R26 | R27 | R28 | *
37 * ------------------------------------------------- *
38 * ------------------------------------------------- *
39 * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
40 * ------------------------------------------------- *
41 * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
42 * ------------------------------------------------- *
43 * | R29 | R30 | R31 | hidden | *
44 * ------------------------------------------------- *
45 * ------------------------------------------------- *
46 * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
47 * ------------------------------------------------- *
48 * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
49 * ------------------------------------------------- *
50 * | CR | LR | PC | back-chain| *
51 * ------------------------------------------------- *
52 * ------------------------------------------------- *
53 * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
54 * ------------------------------------------------- *
55 * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
56 * ------------------------------------------------- *
57 * | cr saved | lr saved | compiler | linker | *
58 * ------------------------------------------------- *
59 * ------------------------------------------------- *
60 * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
61 * ------------------------------------------------- *
62 * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
63 * ------------------------------------------------- *
64 * | TOC saved | FCTX | DATA | | *
65 * ------------------------------------------------- *
66 * *
67 *******************************************************/
68
92f5a8d4 69.file "ontop_ppc64_sysv_elf_gas.S"
7c673cae
FG
70.globl ontop_fcontext
71#if _CALL_ELF == 2
72 .text
73 .align 2
74ontop_fcontext:
75 addis %r2, %r12, .TOC.-ontop_fcontext@ha
76 addi %r2, %r2, .TOC.-ontop_fcontext@l
77 .localentry ontop_fcontext, . - ontop_fcontext
78#else
79 .section ".opd","aw"
80 .align 3
81ontop_fcontext:
82# ifdef _CALL_LINUX
83 .quad .L.ontop_fcontext,.TOC.@tocbase,0
84 .type ontop_fcontext,@function
85 .text
86 .align 2
87.L.ontop_fcontext:
88# else
89 .hidden .ontop_fcontext
90 .globl .ontop_fcontext
91 .quad .ontop_fcontext,.TOC.@tocbase,0
92 .size ontop_fcontext,24
93 .type .ontop_fcontext,@function
94 .text
95 .align 2
96.ontop_fcontext:
97# endif
98#endif
99 # reserve space on stack
100 subi %r1, %r1, 184
101
102#if _CALL_ELF != 2
103 std %r2, 0(%r1) # save TOC
104#endif
105 std %r14, 8(%r1) # save R14
106 std %r15, 16(%r1) # save R15
107 std %r16, 24(%r1) # save R16
108 std %r17, 32(%r1) # save R17
109 std %r18, 40(%r1) # save R18
110 std %r19, 48(%r1) # save R19
111 std %r20, 56(%r1) # save R20
112 std %r21, 64(%r1) # save R21
113 std %r22, 72(%r1) # save R22
114 std %r23, 80(%r1) # save R23
115 std %r24, 88(%r1) # save R24
116 std %r25, 96(%r1) # save R25
117 std %r26, 104(%r1) # save R26
118 std %r27, 112(%r1) # save R27
b32b8144 119 std %r28, 120(%r1) # save R28
7c673cae
FG
120 std %r29, 128(%r1) # save R29
121 std %r30, 136(%r1) # save R30
122 std %r31, 144(%r1) # save R31
b32b8144 123#if _CALL_ELF != 2
7c673cae 124 std %r3, 152(%r1) # save hidden
b32b8144 125#endif
7c673cae
FG
126
127 # save CR
128 mfcr %r0
129 std %r0, 160(%r1)
130 # save LR
131 mflr %r0
132 std %r0, 168(%r1)
133 # save LR as PC
134 std %r0, 176(%r1)
135
136 # store RSP (pointing to context-data) in R7
137 mr %r7, %r1
138
b32b8144
FG
139#if _CALL_ELF == 2
140 # restore RSP (pointing to context-data) from R3
141 mr %r1, %r3
142#else
7c673cae
FG
143 # restore RSP (pointing to context-data) from R4
144 mr %r1, %r4
7c673cae 145#endif
b32b8144 146
7c673cae
FG
147 ld %r14, 8(%r1) # restore R14
148 ld %r15, 16(%r1) # restore R15
149 ld %r16, 24(%r1) # restore R16
150 ld %r17, 32(%r1) # restore R17
151 ld %r18, 40(%r1) # restore R18
152 ld %r19, 48(%r1) # restore R19
153 ld %r20, 56(%r1) # restore R20
154 ld %r21, 64(%r1) # restore R21
155 ld %r22, 72(%r1) # restore R22
156 ld %r23, 80(%r1) # restore R23
157 ld %r24, 88(%r1) # restore R24
158 ld %r25, 96(%r1) # restore R25
159 ld %r26, 104(%r1) # restore R26
160 ld %r27, 112(%r1) # restore R27
161 ld %r28, 120(%r1) # restore R28
162 ld %r29, 128(%r1) # restore R29
163 ld %r30, 136(%r1) # restore R30
164 ld %r31, 144(%r1) # restore R31
b32b8144
FG
165#if _CALL_ELF != 2
166 ld %r3, 152(%r1) # restore hidden
167#endif
7c673cae
FG
168
169 # restore CR
170 ld %r0, 160(%r1)
171 mtcr %r0
b32b8144
FG
172
173#if _CALL_ELF == 2
174 # restore CTR
175 mtctr %r5
176
92f5a8d4
TL
177 # store cb entrypoint in %r12, used for TOC calculation
178 mr %r12, %r5
179
b32b8144
FG
180 # copy transfer_t into ontop_fn arg registers
181 mr %r3, %r7
182 # arg pointer already in %r4
183#else
184 # copy transfer_t into ontop_fn arg registers
185 mr %r4, %r7
186 # arg pointer already in %r5
187 # hidden arg already in %r3
188
189 # restore CTR
190 ld %r7, 0(%r6)
191 mtctr %r7
192 # restore TOC
193 ld %r2, 8(%r6)
194
195 # zero in r3 indicates first jump to context-function
196 cmpdi %r3, 0
197 beq use_entry_arg
198#endif
199
200return_to_ctx:
7c673cae
FG
201 # restore LR
202 ld %r0, 168(%r1)
203 mtlr %r0
7c673cae
FG
204
205 # adjust stack
206 addi %r1, %r1, 184
207
7c673cae
FG
208 # jump to context
209 bctr
b32b8144 210
7c673cae
FG
211#if _CALL_ELF == 2
212 .size ontop_fcontext, .-ontop_fcontext
213#else
b32b8144
FG
214use_entry_arg:
215 # compute return-value struct address
216 # (passed has hidden arg to ontop_fn)
217 addi %r3, %r1, 8
218
219 # jump to context and update LR
220 bctrl
221
222 # restore CTR
223 ld %r7, 176(%r1)
224 mtctr %r7
225#if _CALL_ELF != 2
226 # restore TOC
227 ld %r2, 0(%r1)
228#endif
229
230 # copy returned transfer_t into entry_fn arg registers
231 ld %r3, 8(%r1)
232 ld %r4, 16(%r1)
233
234 b return_to_ctx
7c673cae
FG
235# ifdef _CALL_LINUX
236 .size .ontop_fcontext, .-.L.ontop_fcontext
237# else
238 .size .ontop_fcontext, .-.ontop_fcontext
239# endif
240#endif
241
242
243/* Mark that we don't need executable stack. */
244.section .note.GNU-stack,"",%progbits