]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/src/asm/ontop_ppc32_sysv_xcoff_gas.S
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / context / src / asm / ontop_ppc32_sysv_xcoff_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 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
12 * ------------------------------------------------- *
13 * |bchai| CR | LR |compl| link| TOC | R14 | R15 | *
14 * ------------------------------------------------- *
15 * ------------------------------------------------- *
16 * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
17 * ------------------------------------------------- *
18 * | R16 | R17 | R18 | R19 | R20 | R21 | R22 | R23 | *
19 * ------------------------------------------------- *
20 * ------------------------------------------------- *
21 * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
22 * ------------------------------------------------- *
23 * | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | *
24 * ------------------------------------------------- *
25 * ------------------------------------------------- *
26 * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
27 * ------------------------------------------------- *
28 * | F14 | F15 | F16 | F17 | *
29 * ------------------------------------------------- *
30 * ------------------------------------------------- *
31 * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
32 * ------------------------------------------------- *
33 * | F18 | F19 | F20 | F21 | *
34 * ------------------------------------------------- *
35 * ------------------------------------------------- *
36 * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
37 * ------------------------------------------------- *
38 * | F22 | F23 | F24 | F25 | *
39 * ------------------------------------------------- *
40 * ------------------------------------------------- *
41 * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
42 * ------------------------------------------------- *
43 * | F26 | F27 | F28 | F29 | *
44 * ------------------------------------------------- *
45 * ------------------------------------------------- *
46 * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
47 * ------------------------------------------------- *
48 * | F30 | F31 | PC |hiddn| fpscr | *
49 * ------------------------------------------------- *
50 * ------------------------------------------------- *
51 * | 256 | 260 | 264 | 268 | 272 | 276 | 280 | 284 | *
52 * ------------------------------------------------- *
53 * |bchai|savLR|savLR|compl| link|svTOC| FCTX| DATA| *
54 * ------------------------------------------------- *
55 * *
56 *******************************************************/
57
58 .file "ontop_ppc32_sysv_xcoff_xas.S"
59 .toc
60 .csect .text[PR]
61 .align 2
62 .globl ontop_fcontext[DS]
63 .globl .ontop_fcontext
64 .csect ontop_fcontext[DS]
65 ontop_fcontext:
66 .long .ontop_fcontext[PR], TOC[tc0], 0
67 .csect .text[PR], 5
68 .ontop_fcontext:
69 # reserve space on stack
70 subi 1, 1, 256
71
72 # save CR
73 mfcr 0
74 stw 0, 4(1)
75 # save LR
76 mflr 0
77 stw 0, 8(1)
78 # save LR as PC
79 stw 0, 240(1)
80 # save TOC
81 stw 2, 20(1)
82
83 # Save registers R14 to R31.
84 stw 14, 24(1)
85 stw 15, 28(1)
86 stw 16, 32(1)
87 stw 17, 36(1)
88 stw 18, 40(1)
89 stw 19, 44(1)
90 stw 20, 48(1)
91 stw 21, 52(1)
92 stw 22, 56(1)
93 stw 23, 60(1)
94 stw 24, 64(1)
95 stw 25, 68(1)
96 stw 26, 72(1)
97 stw 27, 76(1)
98 stw 28, 80(1)
99 stw 29, 84(1)
100 stw 30, 88(1)
101 stw 31, 92(1)
102
103 # Save registers F14 to F31 in slots with 8-byte alignment.
104 # 4-byte alignment may stall the pipeline of some processors.
105 # Less than 4 may cause alignment traps.
106 stfd 14, 96(1)
107 stfd 15, 104(1)
108 stfd 16, 112(1)
109 stfd 17, 120(1)
110 stfd 18, 128(1)
111 stfd 19, 136(1)
112 stfd 20, 144(1)
113 stfd 21, 152(1)
114 stfd 22, 160(1)
115 stfd 23, 168(1)
116 stfd 24, 176(1)
117 stfd 25, 184(1)
118 stfd 26, 192(1)
119 stfd 27, 200(1)
120 stfd 28, 208(1)
121 stfd 29, 216(1)
122 stfd 30, 224(1)
123 stfd 31, 232(1)
124
125 # hidden pointer
126 stw 3, 244(1)
127
128 mffs 0 # load FPSCR
129 stfd 0, 248(1) # save FPSCR
130
131 # store RSP (pointing to context-data) in R7
132 mr 7, 1
133
134 # restore RSP (pointing to context-data) from R4
135 mr 1, 4
136
137 # restore CR
138 lwz 0, 4(1)
139 mtcr 0
140
141 # restore R14 to R31
142 lwz 14, 24(1)
143 lwz 15, 28(1)
144 lwz 16, 32(1)
145 lwz 17, 36(1)
146 lwz 18, 40(1)
147 lwz 19, 44(1)
148 lwz 20, 48(1)
149 lwz 21, 52(1)
150 lwz 22, 56(1)
151 lwz 23, 60(1)
152 lwz 24, 64(1)
153 lwz 25, 68(1)
154 lwz 26, 72(1)
155 lwz 27, 76(1)
156 lwz 28, 80(1)
157 lwz 29, 84(1)
158 lwz 30, 88(1)
159 lwz 31, 92(1)
160
161 # restore F14 to F31
162 lfd 14, 96(1)
163 lfd 15, 104(1)
164 lfd 16, 112(1)
165 lfd 17, 120(1)
166 lfd 18, 128(1)
167 lfd 19, 136(1)
168 lfd 20, 144(1)
169 lfd 21, 152(1)
170 lfd 22, 160(1)
171 lfd 23, 168(1)
172 lfd 24, 176(1)
173 lfd 25, 184(1)
174 lfd 26, 192(1)
175 lfd 27, 200(1)
176 lfd 28, 208(1)
177 lfd 29, 216(1)
178 lfd 30, 224(1)
179 lfd 31, 232(1)
180
181 lwz 3, 244(1) # restore hidden
182
183 lfd 0, 248(1) # load FPSCR
184 mtfsf 0xff, 0 # restore FPSCR
185
186 # copy transfer_t into ontop_fn arg registers
187 mr 4, 7
188 # arg pointer already in r5
189 # hidden arg already in r3
190
191 # restore CTR
192 lwz 7, 0(6)
193 mtctr 7
194 # restore TOC
195 lwz 2, 4(6)
196
197 # zero in r3 indicates first jump to context-function
198 cmpdi 3, 0
199 beq use_entry_arg
200
201 return_to_ctx:
202 # restore LR
203 lwz 0, 8(1)
204 mtlr 0
205
206 # adjust stack
207 addi 1, 1, 256
208
209 # jump to context
210 bctr
211
212 use_entry_arg:
213 # compute return-value struct address
214 # (passed has hidden arg to ontop_fn)
215 addi 3, 1, 8
216
217 # jump to context and update LR
218 bctrl
219
220 # restore CTR
221 lwz 7, 4(1)
222 mtctr 7
223 # restore TOC
224 lwz 2, 20(1)
225
226 # copy returned transfer_t into entry_fn arg registers
227 lwz 3, 8(1)
228 lwz 4, 12(1)
229
230 b return_to_ctx