]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_ppc64_sysv_elf_gas.S
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
69 .globl ontop_fcontext
70 #if _CALL_ELF == 2
71 .text
72 .align 2
73 ontop_fcontext:
74 addis %r2, %r12, .TOC.-ontop_fcontext@ha
75 addi %r2, %r2, .TOC.-ontop_fcontext@l
76 .localentry ontop_fcontext, . - ontop_fcontext
77 #else
78 .section ".opd","aw"
79 .align 3
80 ontop_fcontext:
81 # ifdef _CALL_LINUX
82 .quad .L.ontop_fcontext,.TOC.@tocbase,0
83 .type ontop_fcontext,@function
84 .text
85 .align 2
86 .L.ontop_fcontext:
87 # else
88 .hidden .ontop_fcontext
89 .globl .ontop_fcontext
90 .quad .ontop_fcontext,.TOC.@tocbase,0
91 .size ontop_fcontext,24
92 .type .ontop_fcontext,@function
93 .text
94 .align 2
95 .ontop_fcontext:
96 # endif
97 #endif
98 # reserve space on stack
99 subi %r1, %r1, 184
100
101 #if _CALL_ELF != 2
102 std %r2, 0(%r1) # save TOC
103 #endif
104 std %r14, 8(%r1) # save R14
105 std %r15, 16(%r1) # save R15
106 std %r16, 24(%r1) # save R16
107 std %r17, 32(%r1) # save R17
108 std %r18, 40(%r1) # save R18
109 std %r19, 48(%r1) # save R19
110 std %r20, 56(%r1) # save R20
111 std %r21, 64(%r1) # save R21
112 std %r22, 72(%r1) # save R22
113 std %r23, 80(%r1) # save R23
114 std %r24, 88(%r1) # save R24
115 std %r25, 96(%r1) # save R25
116 std %r26, 104(%r1) # save R26
117 std %r27, 112(%r1) # save R27
118 std %r28, 120(%r1) # save R28
119 std %r29, 128(%r1) # save R29
120 std %r30, 136(%r1) # save R30
121 std %r31, 144(%r1) # save R31
122 #if _CALL_ELF != 2
123 std %r3, 152(%r1) # save hidden
124 #endif
125
126 # save CR
127 mfcr %r0
128 std %r0, 160(%r1)
129 # save LR
130 mflr %r0
131 std %r0, 168(%r1)
132 # save LR as PC
133 std %r0, 176(%r1)
134
135 # store RSP (pointing to context-data) in R7
136 mr %r7, %r1
137
138 #if _CALL_ELF == 2
139 # restore RSP (pointing to context-data) from R3
140 mr %r1, %r3
141 #else
142 # restore RSP (pointing to context-data) from R4
143 mr %r1, %r4
144 #endif
145
146 ld %r14, 8(%r1) # restore R14
147 ld %r15, 16(%r1) # restore R15
148 ld %r16, 24(%r1) # restore R16
149 ld %r17, 32(%r1) # restore R17
150 ld %r18, 40(%r1) # restore R18
151 ld %r19, 48(%r1) # restore R19
152 ld %r20, 56(%r1) # restore R20
153 ld %r21, 64(%r1) # restore R21
154 ld %r22, 72(%r1) # restore R22
155 ld %r23, 80(%r1) # restore R23
156 ld %r24, 88(%r1) # restore R24
157 ld %r25, 96(%r1) # restore R25
158 ld %r26, 104(%r1) # restore R26
159 ld %r27, 112(%r1) # restore R27
160 ld %r28, 120(%r1) # restore R28
161 ld %r29, 128(%r1) # restore R29
162 ld %r30, 136(%r1) # restore R30
163 ld %r31, 144(%r1) # restore R31
164 #if _CALL_ELF != 2
165 ld %r3, 152(%r1) # restore hidden
166 #endif
167
168 # restore CR
169 ld %r0, 160(%r1)
170 mtcr %r0
171
172 #if _CALL_ELF == 2
173 # restore CTR
174 mtctr %r5
175
176 # copy transfer_t into ontop_fn arg registers
177 mr %r3, %r7
178 # arg pointer already in %r4
179 #else
180 # copy transfer_t into ontop_fn arg registers
181 mr %r4, %r7
182 # arg pointer already in %r5
183 # hidden arg already in %r3
184
185 # restore CTR
186 ld %r7, 0(%r6)
187 mtctr %r7
188 # restore TOC
189 ld %r2, 8(%r6)
190
191 # zero in r3 indicates first jump to context-function
192 cmpdi %r3, 0
193 beq use_entry_arg
194 #endif
195
196 return_to_ctx:
197 # restore LR
198 ld %r0, 168(%r1)
199 mtlr %r0
200
201 # adjust stack
202 addi %r1, %r1, 184
203
204 # jump to context
205 bctr
206
207 #if _CALL_ELF == 2
208 .size ontop_fcontext, .-ontop_fcontext
209 #else
210 use_entry_arg:
211 # compute return-value struct address
212 # (passed has hidden arg to ontop_fn)
213 addi %r3, %r1, 8
214
215 # jump to context and update LR
216 bctrl
217
218 # restore CTR
219 ld %r7, 176(%r1)
220 mtctr %r7
221 #if _CALL_ELF != 2
222 # restore TOC
223 ld %r2, 0(%r1)
224 #endif
225
226 # copy returned transfer_t into entry_fn arg registers
227 ld %r3, 8(%r1)
228 ld %r4, 16(%r1)
229
230 b return_to_ctx
231 # ifdef _CALL_LINUX
232 .size .ontop_fcontext, .-.L.ontop_fcontext
233 # else
234 .size .ontop_fcontext, .-.ontop_fcontext
235 # endif
236 #endif
237
238
239 /* Mark that we don't need executable stack. */
240 .section .note.GNU-stack,"",%progbits