1 | /*
|
---|
2 | * Copyright (c) 2005 Jakub Vana
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup ia64
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | *
|
---|
34 | */
|
---|
35 |
|
---|
36 | #include <fpu_context.h>
|
---|
37 | #include <arch/register.h>
|
---|
38 | #include <print.h>
|
---|
39 |
|
---|
40 | void fpu_context_save(fpu_context_t *fctx)
|
---|
41 | {
|
---|
42 | asm volatile (
|
---|
43 | "stf.spill %[f32] = f32\n"
|
---|
44 | "stf.spill %[f33] = f33\n"
|
---|
45 | "stf.spill %[f34] = f34\n"
|
---|
46 | "stf.spill %[f35] = f35\n"
|
---|
47 | "stf.spill %[f36] = f36\n"
|
---|
48 | "stf.spill %[f37] = f37\n"
|
---|
49 | "stf.spill %[f38] = f38\n"
|
---|
50 | "stf.spill %[f39] = f39\n"
|
---|
51 | "stf.spill %[f40] = f40\n"
|
---|
52 | "stf.spill %[f41] = f41\n"
|
---|
53 | "stf.spill %[f42] = f42\n"
|
---|
54 | "stf.spill %[f43] = f43\n"
|
---|
55 | "stf.spill %[f44] = f44\n"
|
---|
56 | "stf.spill %[f45] = f45\n"
|
---|
57 | "stf.spill %[f46] = f46\n"
|
---|
58 | "stf.spill %[f47] = f47\n"
|
---|
59 | "stf.spill %[f48] = f48\n"
|
---|
60 | "stf.spill %[f49] = f49\n"
|
---|
61 | "stf.spill %[f50] = f50\n"
|
---|
62 | "stf.spill %[f51] = f51\n"
|
---|
63 | "stf.spill %[f52] = f52\n"
|
---|
64 | "stf.spill %[f53] = f53\n"
|
---|
65 | "stf.spill %[f54] = f54\n"
|
---|
66 | "stf.spill %[f55] = f55\n"
|
---|
67 | "stf.spill %[f56] = f56\n"
|
---|
68 | "stf.spill %[f57] = f57\n"
|
---|
69 | "stf.spill %[f58] = f58\n"
|
---|
70 | "stf.spill %[f59] = f59\n"
|
---|
71 | "stf.spill %[f60] = f60\n"
|
---|
72 | "stf.spill %[f61] = f61\n"
|
---|
73 | :
|
---|
74 | [f32] "=m" (fctx->fr[0]),
|
---|
75 | [f33] "=m" (fctx->fr[1]),
|
---|
76 | [f34] "=m" (fctx->fr[2]),
|
---|
77 | [f35] "=m" (fctx->fr[3]),
|
---|
78 | [f36] "=m" (fctx->fr[4]),
|
---|
79 | [f37] "=m" (fctx->fr[5]),
|
---|
80 | [f38] "=m" (fctx->fr[6]),
|
---|
81 | [f39] "=m" (fctx->fr[7]),
|
---|
82 | [f40] "=m" (fctx->fr[8]),
|
---|
83 | [f41] "=m" (fctx->fr[9]),
|
---|
84 | [f42] "=m" (fctx->fr[10]),
|
---|
85 | [f43] "=m" (fctx->fr[11]),
|
---|
86 | [f44] "=m" (fctx->fr[12]),
|
---|
87 | [f45] "=m" (fctx->fr[13]),
|
---|
88 | [f46] "=m" (fctx->fr[14]),
|
---|
89 | [f47] "=m" (fctx->fr[15]),
|
---|
90 | [f48] "=m" (fctx->fr[16]),
|
---|
91 | [f49] "=m" (fctx->fr[17]),
|
---|
92 | [f50] "=m" (fctx->fr[18]),
|
---|
93 | [f51] "=m" (fctx->fr[19]),
|
---|
94 | [f52] "=m" (fctx->fr[20]),
|
---|
95 | [f53] "=m" (fctx->fr[21]),
|
---|
96 | [f54] "=m" (fctx->fr[22]),
|
---|
97 | [f55] "=m" (fctx->fr[23]),
|
---|
98 | [f56] "=m" (fctx->fr[24]),
|
---|
99 | [f57] "=m" (fctx->fr[25]),
|
---|
100 | [f58] "=m" (fctx->fr[26]),
|
---|
101 | [f59] "=m" (fctx->fr[27]),
|
---|
102 | [f60] "=m" (fctx->fr[28]),
|
---|
103 | [f61] "=m" (fctx->fr[29])
|
---|
104 | );
|
---|
105 |
|
---|
106 | asm volatile (
|
---|
107 | "stf.spill %[f62] = f62\n"
|
---|
108 | "stf.spill %[f63] = f63\n"
|
---|
109 | "stf.spill %[f64] = f64\n"
|
---|
110 | "stf.spill %[f65] = f65\n"
|
---|
111 | "stf.spill %[f66] = f66\n"
|
---|
112 | "stf.spill %[f67] = f67\n"
|
---|
113 | "stf.spill %[f68] = f68\n"
|
---|
114 | "stf.spill %[f69] = f69\n"
|
---|
115 | "stf.spill %[f70] = f70\n"
|
---|
116 | "stf.spill %[f71] = f71\n"
|
---|
117 | "stf.spill %[f72] = f72\n"
|
---|
118 | "stf.spill %[f73] = f73\n"
|
---|
119 | "stf.spill %[f74] = f74\n"
|
---|
120 | "stf.spill %[f75] = f75\n"
|
---|
121 | "stf.spill %[f76] = f76\n"
|
---|
122 | "stf.spill %[f77] = f77\n"
|
---|
123 | "stf.spill %[f78] = f78\n"
|
---|
124 | "stf.spill %[f79] = f79\n"
|
---|
125 | "stf.spill %[f80] = f80\n"
|
---|
126 | "stf.spill %[f81] = f81\n"
|
---|
127 | "stf.spill %[f82] = f82\n"
|
---|
128 | "stf.spill %[f83] = f83\n"
|
---|
129 | "stf.spill %[f84] = f84\n"
|
---|
130 | "stf.spill %[f85] = f85\n"
|
---|
131 | "stf.spill %[f86] = f86\n"
|
---|
132 | "stf.spill %[f87] = f87\n"
|
---|
133 | "stf.spill %[f88] = f88\n"
|
---|
134 | "stf.spill %[f89] = f89\n"
|
---|
135 | "stf.spill %[f90] = f90\n"
|
---|
136 | "stf.spill %[f91] = f91\n"
|
---|
137 | :
|
---|
138 | [f62] "=m" (fctx->fr[30]),
|
---|
139 | [f63] "=m" (fctx->fr[31]),
|
---|
140 | [f64] "=m" (fctx->fr[32]),
|
---|
141 | [f65] "=m" (fctx->fr[33]),
|
---|
142 | [f66] "=m" (fctx->fr[34]),
|
---|
143 | [f67] "=m" (fctx->fr[35]),
|
---|
144 | [f68] "=m" (fctx->fr[36]),
|
---|
145 | [f69] "=m" (fctx->fr[37]),
|
---|
146 | [f70] "=m" (fctx->fr[38]),
|
---|
147 | [f71] "=m" (fctx->fr[39]),
|
---|
148 | [f72] "=m" (fctx->fr[40]),
|
---|
149 | [f73] "=m" (fctx->fr[41]),
|
---|
150 | [f74] "=m" (fctx->fr[42]),
|
---|
151 | [f75] "=m" (fctx->fr[43]),
|
---|
152 | [f76] "=m" (fctx->fr[44]),
|
---|
153 | [f77] "=m" (fctx->fr[45]),
|
---|
154 | [f78] "=m" (fctx->fr[46]),
|
---|
155 | [f79] "=m" (fctx->fr[47]),
|
---|
156 | [f80] "=m" (fctx->fr[48]),
|
---|
157 | [f81] "=m" (fctx->fr[49]),
|
---|
158 | [f82] "=m" (fctx->fr[50]),
|
---|
159 | [f83] "=m" (fctx->fr[51]),
|
---|
160 | [f84] "=m" (fctx->fr[52]),
|
---|
161 | [f85] "=m" (fctx->fr[53]),
|
---|
162 | [f86] "=m" (fctx->fr[54]),
|
---|
163 | [f87] "=m" (fctx->fr[55]),
|
---|
164 | [f88] "=m" (fctx->fr[56]),
|
---|
165 | [f89] "=m" (fctx->fr[57]),
|
---|
166 | [f90] "=m" (fctx->fr[58]),
|
---|
167 | [f91] "=m" (fctx->fr[59])
|
---|
168 | );
|
---|
169 |
|
---|
170 | asm volatile (
|
---|
171 | "stf.spill %[f92] = f92\n"
|
---|
172 | "stf.spill %[f93] = f93\n"
|
---|
173 | "stf.spill %[f94] = f94\n"
|
---|
174 | "stf.spill %[f95] = f95\n"
|
---|
175 | "stf.spill %[f96] = f96\n"
|
---|
176 | "stf.spill %[f97] = f97\n"
|
---|
177 | "stf.spill %[f98] = f98\n"
|
---|
178 | "stf.spill %[f99] = f99\n"
|
---|
179 | "stf.spill %[f100] = f100\n"
|
---|
180 | "stf.spill %[f101] = f101\n"
|
---|
181 | "stf.spill %[f102] = f102\n"
|
---|
182 | "stf.spill %[f103] = f103\n"
|
---|
183 | "stf.spill %[f104] = f104\n"
|
---|
184 | "stf.spill %[f105] = f105\n"
|
---|
185 | "stf.spill %[f106] = f106\n"
|
---|
186 | "stf.spill %[f107] = f107\n"
|
---|
187 | "stf.spill %[f108] = f108\n"
|
---|
188 | "stf.spill %[f109] = f109\n"
|
---|
189 | "stf.spill %[f110] = f110\n"
|
---|
190 | "stf.spill %[f111] = f111\n"
|
---|
191 | "stf.spill %[f112] = f112\n"
|
---|
192 | "stf.spill %[f113] = f113\n"
|
---|
193 | "stf.spill %[f114] = f114\n"
|
---|
194 | "stf.spill %[f115] = f115\n"
|
---|
195 | "stf.spill %[f116] = f116\n"
|
---|
196 | "stf.spill %[f117] = f117\n"
|
---|
197 | "stf.spill %[f118] = f118\n"
|
---|
198 | "stf.spill %[f119] = f119\n"
|
---|
199 | "stf.spill %[f120] = f120\n"
|
---|
200 | "stf.spill %[f121] = f121\n"
|
---|
201 | :
|
---|
202 | [f92] "=m" (fctx->fr[60]),
|
---|
203 | [f93] "=m" (fctx->fr[61]),
|
---|
204 | [f94] "=m" (fctx->fr[62]),
|
---|
205 | [f95] "=m" (fctx->fr[63]),
|
---|
206 | [f96] "=m" (fctx->fr[64]),
|
---|
207 | [f97] "=m" (fctx->fr[65]),
|
---|
208 | [f98] "=m" (fctx->fr[66]),
|
---|
209 | [f99] "=m" (fctx->fr[67]),
|
---|
210 | [f100] "=m" (fctx->fr[68]),
|
---|
211 | [f101] "=m" (fctx->fr[69]),
|
---|
212 | [f102] "=m" (fctx->fr[70]),
|
---|
213 | [f103] "=m" (fctx->fr[71]),
|
---|
214 | [f104] "=m" (fctx->fr[72]),
|
---|
215 | [f105] "=m" (fctx->fr[73]),
|
---|
216 | [f106] "=m" (fctx->fr[74]),
|
---|
217 | [f107] "=m" (fctx->fr[75]),
|
---|
218 | [f108] "=m" (fctx->fr[76]),
|
---|
219 | [f109] "=m" (fctx->fr[77]),
|
---|
220 | [f110] "=m" (fctx->fr[78]),
|
---|
221 | [f111] "=m" (fctx->fr[79]),
|
---|
222 | [f112] "=m" (fctx->fr[80]),
|
---|
223 | [f113] "=m" (fctx->fr[81]),
|
---|
224 | [f114] "=m" (fctx->fr[82]),
|
---|
225 | [f115] "=m" (fctx->fr[83]),
|
---|
226 | [f116] "=m" (fctx->fr[84]),
|
---|
227 | [f117] "=m" (fctx->fr[85]),
|
---|
228 | [f118] "=m" (fctx->fr[86]),
|
---|
229 | [f119] "=m" (fctx->fr[87]),
|
---|
230 | [f120] "=m" (fctx->fr[88]),
|
---|
231 | [f121] "=m" (fctx->fr[89])
|
---|
232 | );
|
---|
233 |
|
---|
234 | asm volatile (
|
---|
235 | "stf.spill %[f122] = f122\n"
|
---|
236 | "stf.spill %[f123] = f123\n"
|
---|
237 | "stf.spill %[f124] = f124\n"
|
---|
238 | "stf.spill %[f125] = f125\n"
|
---|
239 | "stf.spill %[f126] = f126\n"
|
---|
240 | "stf.spill %[f127] = f127\n"
|
---|
241 | :
|
---|
242 | [f122] "=m" (fctx->fr[90]),
|
---|
243 | [f123] "=m" (fctx->fr[91]),
|
---|
244 | [f124] "=m" (fctx->fr[92]),
|
---|
245 | [f125] "=m" (fctx->fr[93]),
|
---|
246 | [f126] "=m" (fctx->fr[94]),
|
---|
247 | [f127] "=m" (fctx->fr[95])
|
---|
248 | );
|
---|
249 | }
|
---|
250 |
|
---|
251 | void fpu_context_restore(fpu_context_t *fctx)
|
---|
252 | {
|
---|
253 | asm volatile (
|
---|
254 | "ldf.fill f32 = %[f32]\n"
|
---|
255 | "ldf.fill f33 = %[f33]\n"
|
---|
256 | "ldf.fill f34 = %[f34]\n"
|
---|
257 | "ldf.fill f35 = %[f35]\n"
|
---|
258 | "ldf.fill f36 = %[f36]\n"
|
---|
259 | "ldf.fill f37 = %[f37]\n"
|
---|
260 | "ldf.fill f38 = %[f38]\n"
|
---|
261 | "ldf.fill f39 = %[f39]\n"
|
---|
262 | "ldf.fill f40 = %[f40]\n"
|
---|
263 | "ldf.fill f41 = %[f41]\n"
|
---|
264 | "ldf.fill f42 = %[f42]\n"
|
---|
265 | "ldf.fill f43 = %[f43]\n"
|
---|
266 | "ldf.fill f44 = %[f44]\n"
|
---|
267 | "ldf.fill f45 = %[f45]\n"
|
---|
268 | "ldf.fill f46 = %[f46]\n"
|
---|
269 | "ldf.fill f47 = %[f47]\n"
|
---|
270 | "ldf.fill f48 = %[f48]\n"
|
---|
271 | "ldf.fill f49 = %[f49]\n"
|
---|
272 | "ldf.fill f50 = %[f50]\n"
|
---|
273 | "ldf.fill f51 = %[f51]\n"
|
---|
274 | "ldf.fill f52 = %[f52]\n"
|
---|
275 | "ldf.fill f53 = %[f53]\n"
|
---|
276 | "ldf.fill f54 = %[f54]\n"
|
---|
277 | "ldf.fill f55 = %[f55]\n"
|
---|
278 | "ldf.fill f56 = %[f56]\n"
|
---|
279 | "ldf.fill f57 = %[f57]\n"
|
---|
280 | "ldf.fill f58 = %[f58]\n"
|
---|
281 | "ldf.fill f59 = %[f59]\n"
|
---|
282 | "ldf.fill f60 = %[f60]\n"
|
---|
283 | "ldf.fill f61 = %[f61]\n"
|
---|
284 | ::
|
---|
285 | [f32] "m" (fctx->fr[0]),
|
---|
286 | [f33] "m" (fctx->fr[1]),
|
---|
287 | [f34] "m" (fctx->fr[2]),
|
---|
288 | [f35] "m" (fctx->fr[3]),
|
---|
289 | [f36] "m" (fctx->fr[4]),
|
---|
290 | [f37] "m" (fctx->fr[5]),
|
---|
291 | [f38] "m" (fctx->fr[6]),
|
---|
292 | [f39] "m" (fctx->fr[7]),
|
---|
293 | [f40] "m" (fctx->fr[8]),
|
---|
294 | [f41] "m" (fctx->fr[9]),
|
---|
295 | [f42] "m" (fctx->fr[10]),
|
---|
296 | [f43] "m" (fctx->fr[11]),
|
---|
297 | [f44] "m" (fctx->fr[12]),
|
---|
298 | [f45] "m" (fctx->fr[13]),
|
---|
299 | [f46] "m" (fctx->fr[14]),
|
---|
300 | [f47] "m" (fctx->fr[15]),
|
---|
301 | [f48] "m" (fctx->fr[16]),
|
---|
302 | [f49] "m" (fctx->fr[17]),
|
---|
303 | [f50] "m" (fctx->fr[18]),
|
---|
304 | [f51] "m" (fctx->fr[19]),
|
---|
305 | [f52] "m" (fctx->fr[20]),
|
---|
306 | [f53] "m" (fctx->fr[21]),
|
---|
307 | [f54] "m" (fctx->fr[22]),
|
---|
308 | [f55] "m" (fctx->fr[23]),
|
---|
309 | [f56] "m" (fctx->fr[24]),
|
---|
310 | [f57] "m" (fctx->fr[25]),
|
---|
311 | [f58] "m" (fctx->fr[26]),
|
---|
312 | [f59] "m" (fctx->fr[27]),
|
---|
313 | [f60] "m" (fctx->fr[28]),
|
---|
314 | [f61] "m" (fctx->fr[29])
|
---|
315 | );
|
---|
316 |
|
---|
317 | asm volatile (
|
---|
318 | "ldf.fill f62 = %[f62]\n"
|
---|
319 | "ldf.fill f63 = %[f63]\n"
|
---|
320 | "ldf.fill f64 = %[f64]\n"
|
---|
321 | "ldf.fill f65 = %[f65]\n"
|
---|
322 | "ldf.fill f66 = %[f66]\n"
|
---|
323 | "ldf.fill f67 = %[f67]\n"
|
---|
324 | "ldf.fill f68 = %[f68]\n"
|
---|
325 | "ldf.fill f69 = %[f69]\n"
|
---|
326 | "ldf.fill f70 = %[f70]\n"
|
---|
327 | "ldf.fill f71 = %[f71]\n"
|
---|
328 | "ldf.fill f72 = %[f72]\n"
|
---|
329 | "ldf.fill f73 = %[f73]\n"
|
---|
330 | "ldf.fill f74 = %[f74]\n"
|
---|
331 | "ldf.fill f75 = %[f75]\n"
|
---|
332 | "ldf.fill f76 = %[f76]\n"
|
---|
333 | "ldf.fill f77 = %[f77]\n"
|
---|
334 | "ldf.fill f78 = %[f78]\n"
|
---|
335 | "ldf.fill f79 = %[f79]\n"
|
---|
336 | "ldf.fill f80 = %[f80]\n"
|
---|
337 | "ldf.fill f81 = %[f81]\n"
|
---|
338 | "ldf.fill f82 = %[f82]\n"
|
---|
339 | "ldf.fill f83 = %[f83]\n"
|
---|
340 | "ldf.fill f84 = %[f84]\n"
|
---|
341 | "ldf.fill f85 = %[f85]\n"
|
---|
342 | "ldf.fill f86 = %[f86]\n"
|
---|
343 | "ldf.fill f87 = %[f87]\n"
|
---|
344 | "ldf.fill f88 = %[f88]\n"
|
---|
345 | "ldf.fill f89 = %[f89]\n"
|
---|
346 | "ldf.fill f90 = %[f90]\n"
|
---|
347 | "ldf.fill f91 = %[f91]\n"
|
---|
348 | ::
|
---|
349 | [f62] "m" (fctx->fr[30]),
|
---|
350 | [f63] "m" (fctx->fr[31]),
|
---|
351 | [f64] "m" (fctx->fr[32]),
|
---|
352 | [f65] "m" (fctx->fr[33]),
|
---|
353 | [f66] "m" (fctx->fr[34]),
|
---|
354 | [f67] "m" (fctx->fr[35]),
|
---|
355 | [f68] "m" (fctx->fr[36]),
|
---|
356 | [f69] "m" (fctx->fr[37]),
|
---|
357 | [f70] "m" (fctx->fr[38]),
|
---|
358 | [f71] "m" (fctx->fr[39]),
|
---|
359 | [f72] "m" (fctx->fr[40]),
|
---|
360 | [f73] "m" (fctx->fr[41]),
|
---|
361 | [f74] "m" (fctx->fr[42]),
|
---|
362 | [f75] "m" (fctx->fr[43]),
|
---|
363 | [f76] "m" (fctx->fr[44]),
|
---|
364 | [f77] "m" (fctx->fr[45]),
|
---|
365 | [f78] "m" (fctx->fr[46]),
|
---|
366 | [f79] "m" (fctx->fr[47]),
|
---|
367 | [f80] "m" (fctx->fr[48]),
|
---|
368 | [f81] "m" (fctx->fr[49]),
|
---|
369 | [f82] "m" (fctx->fr[50]),
|
---|
370 | [f83] "m" (fctx->fr[51]),
|
---|
371 | [f84] "m" (fctx->fr[52]),
|
---|
372 | [f85] "m" (fctx->fr[53]),
|
---|
373 | [f86] "m" (fctx->fr[54]),
|
---|
374 | [f87] "m" (fctx->fr[55]),
|
---|
375 | [f88] "m" (fctx->fr[56]),
|
---|
376 | [f89] "m" (fctx->fr[57]),
|
---|
377 | [f90] "m" (fctx->fr[58]),
|
---|
378 | [f91] "m" (fctx->fr[59])
|
---|
379 | );
|
---|
380 |
|
---|
381 | asm volatile (
|
---|
382 | "ldf.fill f92 = %[f92]\n"
|
---|
383 | "ldf.fill f93 = %[f93]\n"
|
---|
384 | "ldf.fill f94 = %[f94]\n"
|
---|
385 | "ldf.fill f95 = %[f95]\n"
|
---|
386 | "ldf.fill f96 = %[f96]\n"
|
---|
387 | "ldf.fill f97 = %[f97]\n"
|
---|
388 | "ldf.fill f98 = %[f98]\n"
|
---|
389 | "ldf.fill f99 = %[f99]\n"
|
---|
390 | "ldf.fill f100 = %[f100]\n"
|
---|
391 | "ldf.fill f101 = %[f101]\n"
|
---|
392 | "ldf.fill f102 = %[f102]\n"
|
---|
393 | "ldf.fill f103 = %[f103]\n"
|
---|
394 | "ldf.fill f104 = %[f104]\n"
|
---|
395 | "ldf.fill f105 = %[f105]\n"
|
---|
396 | "ldf.fill f106 = %[f106]\n"
|
---|
397 | "ldf.fill f107 = %[f107]\n"
|
---|
398 | "ldf.fill f108 = %[f108]\n"
|
---|
399 | "ldf.fill f109 = %[f109]\n"
|
---|
400 | "ldf.fill f110 = %[f110]\n"
|
---|
401 | "ldf.fill f111 = %[f111]\n"
|
---|
402 | "ldf.fill f112 = %[f112]\n"
|
---|
403 | "ldf.fill f113 = %[f113]\n"
|
---|
404 | "ldf.fill f114 = %[f114]\n"
|
---|
405 | "ldf.fill f115 = %[f115]\n"
|
---|
406 | "ldf.fill f116 = %[f116]\n"
|
---|
407 | "ldf.fill f117 = %[f117]\n"
|
---|
408 | "ldf.fill f118 = %[f118]\n"
|
---|
409 | "ldf.fill f119 = %[f119]\n"
|
---|
410 | "ldf.fill f120 = %[f120]\n"
|
---|
411 | "ldf.fill f121 = %[f121]\n"
|
---|
412 | ::
|
---|
413 | [f92] "m" (fctx->fr[60]),
|
---|
414 | [f93] "m" (fctx->fr[61]),
|
---|
415 | [f94] "m" (fctx->fr[62]),
|
---|
416 | [f95] "m" (fctx->fr[63]),
|
---|
417 | [f96] "m" (fctx->fr[64]),
|
---|
418 | [f97] "m" (fctx->fr[65]),
|
---|
419 | [f98] "m" (fctx->fr[66]),
|
---|
420 | [f99] "m" (fctx->fr[67]),
|
---|
421 | [f100] "m" (fctx->fr[68]),
|
---|
422 | [f101] "m" (fctx->fr[69]),
|
---|
423 | [f102] "m" (fctx->fr[70]),
|
---|
424 | [f103] "m" (fctx->fr[71]),
|
---|
425 | [f104] "m" (fctx->fr[72]),
|
---|
426 | [f105] "m" (fctx->fr[73]),
|
---|
427 | [f106] "m" (fctx->fr[74]),
|
---|
428 | [f107] "m" (fctx->fr[75]),
|
---|
429 | [f108] "m" (fctx->fr[76]),
|
---|
430 | [f109] "m" (fctx->fr[77]),
|
---|
431 | [f110] "m" (fctx->fr[78]),
|
---|
432 | [f111] "m" (fctx->fr[79]),
|
---|
433 | [f112] "m" (fctx->fr[80]),
|
---|
434 | [f113] "m" (fctx->fr[81]),
|
---|
435 | [f114] "m" (fctx->fr[82]),
|
---|
436 | [f115] "m" (fctx->fr[83]),
|
---|
437 | [f116] "m" (fctx->fr[84]),
|
---|
438 | [f117] "m" (fctx->fr[85]),
|
---|
439 | [f118] "m" (fctx->fr[86]),
|
---|
440 | [f119] "m" (fctx->fr[87]),
|
---|
441 | [f120] "m" (fctx->fr[88]),
|
---|
442 | [f121] "m" (fctx->fr[89])
|
---|
443 | );
|
---|
444 |
|
---|
445 | asm volatile (
|
---|
446 | "ldf.fill f122 = %[f122]\n"
|
---|
447 | "ldf.fill f123 = %[f123]\n"
|
---|
448 | "ldf.fill f124 = %[f124]\n"
|
---|
449 | "ldf.fill f125 = %[f125]\n"
|
---|
450 | "ldf.fill f126 = %[f126]\n"
|
---|
451 | "ldf.fill f127 = %[f127]\n"
|
---|
452 | ::
|
---|
453 | [f122] "m" (fctx->fr[90]),
|
---|
454 | [f123] "m" (fctx->fr[91]),
|
---|
455 | [f124] "m" (fctx->fr[92]),
|
---|
456 | [f125] "m" (fctx->fr[93]),
|
---|
457 | [f126] "m" (fctx->fr[94]),
|
---|
458 | [f127] "m" (fctx->fr[95])
|
---|
459 | );
|
---|
460 | }
|
---|
461 |
|
---|
462 | void fpu_enable(void)
|
---|
463 | {
|
---|
464 | asm volatile (
|
---|
465 | "rsm %0 ;;"
|
---|
466 | "srlz.i\n"
|
---|
467 | "srlz.d ;;\n"
|
---|
468 | :
|
---|
469 | : "i" (PSR_DFH_MASK)
|
---|
470 | );
|
---|
471 | }
|
---|
472 |
|
---|
473 | void fpu_disable(void)
|
---|
474 | {
|
---|
475 | asm volatile (
|
---|
476 | "ssm %0 ;;\n"
|
---|
477 | "srlz.i\n"
|
---|
478 | "srlz.d ;;\n"
|
---|
479 | :
|
---|
480 | : "i" (PSR_DFH_MASK)
|
---|
481 | );
|
---|
482 | }
|
---|
483 |
|
---|
484 | void fpu_init(void)
|
---|
485 | {
|
---|
486 | uint64_t a = 0;
|
---|
487 |
|
---|
488 | asm volatile (
|
---|
489 | "mov %0 = ar.fpsr ;;\n"
|
---|
490 | "or %0 = %0,%1 ;;\n"
|
---|
491 | "mov ar.fpsr = %0 ;;\n"
|
---|
492 | : "+r" (a)
|
---|
493 | : "r" (FPSR_TRAPS_ALL)
|
---|
494 | );
|
---|
495 |
|
---|
496 | asm volatile (
|
---|
497 | "mov f2 = f0\n"
|
---|
498 | "mov f3 = f0\n"
|
---|
499 | "mov f4 = f0\n"
|
---|
500 | "mov f5 = f0\n"
|
---|
501 | "mov f6 = f0\n"
|
---|
502 | "mov f7 = f0\n"
|
---|
503 | "mov f8 = f0\n"
|
---|
504 | "mov f9 = f0\n"
|
---|
505 |
|
---|
506 | "mov f10 = f0\n"
|
---|
507 | "mov f11 = f0\n"
|
---|
508 | "mov f12 = f0\n"
|
---|
509 | "mov f13 = f0\n"
|
---|
510 | "mov f14 = f0\n"
|
---|
511 | "mov f15 = f0\n"
|
---|
512 | "mov f16 = f0\n"
|
---|
513 | "mov f17 = f0\n"
|
---|
514 | "mov f18 = f0\n"
|
---|
515 | "mov f19 = f0\n"
|
---|
516 |
|
---|
517 | "mov f20 = f0\n"
|
---|
518 | "mov f21 = f0\n"
|
---|
519 | "mov f22 = f0\n"
|
---|
520 | "mov f23 = f0\n"
|
---|
521 | "mov f24 = f0\n"
|
---|
522 | "mov f25 = f0\n"
|
---|
523 | "mov f26 = f0\n"
|
---|
524 | "mov f27 = f0\n"
|
---|
525 | "mov f28 = f0\n"
|
---|
526 | "mov f29 = f0\n"
|
---|
527 |
|
---|
528 | "mov f30 = f0\n"
|
---|
529 | "mov f31 = f0\n"
|
---|
530 | "mov f32 = f0\n"
|
---|
531 | "mov f33 = f0\n"
|
---|
532 | "mov f34 = f0\n"
|
---|
533 | "mov f35 = f0\n"
|
---|
534 | "mov f36 = f0\n"
|
---|
535 | "mov f37 = f0\n"
|
---|
536 | "mov f38 = f0\n"
|
---|
537 | "mov f39 = f0\n"
|
---|
538 |
|
---|
539 | "mov f40 = f0\n"
|
---|
540 | "mov f41 = f0\n"
|
---|
541 | "mov f42 = f0\n"
|
---|
542 | "mov f43 = f0\n"
|
---|
543 | "mov f44 = f0\n"
|
---|
544 | "mov f45 = f0\n"
|
---|
545 | "mov f46 = f0\n"
|
---|
546 | "mov f47 = f0\n"
|
---|
547 | "mov f48 = f0\n"
|
---|
548 | "mov f49 = f0\n"
|
---|
549 |
|
---|
550 | "mov f50 = f0\n"
|
---|
551 | "mov f51 = f0\n"
|
---|
552 | "mov f52 = f0\n"
|
---|
553 | "mov f53 = f0\n"
|
---|
554 | "mov f54 = f0\n"
|
---|
555 | "mov f55 = f0\n"
|
---|
556 | "mov f56 = f0\n"
|
---|
557 | "mov f57 = f0\n"
|
---|
558 | "mov f58 = f0\n"
|
---|
559 | "mov f59 = f0\n"
|
---|
560 |
|
---|
561 | "mov f60 = f0\n"
|
---|
562 | "mov f61 = f0\n"
|
---|
563 | "mov f62 = f0\n"
|
---|
564 | "mov f63 = f0\n"
|
---|
565 | "mov f64 = f0\n"
|
---|
566 | "mov f65 = f0\n"
|
---|
567 | "mov f66 = f0\n"
|
---|
568 | "mov f67 = f0\n"
|
---|
569 | "mov f68 = f0\n"
|
---|
570 | "mov f69 = f0\n"
|
---|
571 |
|
---|
572 | "mov f70 = f0\n"
|
---|
573 | "mov f71 = f0\n"
|
---|
574 | "mov f72 = f0\n"
|
---|
575 | "mov f73 = f0\n"
|
---|
576 | "mov f74 = f0\n"
|
---|
577 | "mov f75 = f0\n"
|
---|
578 | "mov f76 = f0\n"
|
---|
579 | "mov f77 = f0\n"
|
---|
580 | "mov f78 = f0\n"
|
---|
581 | "mov f79 = f0\n"
|
---|
582 |
|
---|
583 | "mov f80 = f0\n"
|
---|
584 | "mov f81 = f0\n"
|
---|
585 | "mov f82 = f0\n"
|
---|
586 | "mov f83 = f0\n"
|
---|
587 | "mov f84 = f0\n"
|
---|
588 | "mov f85 = f0\n"
|
---|
589 | "mov f86 = f0\n"
|
---|
590 | "mov f87 = f0\n"
|
---|
591 | "mov f88 = f0\n"
|
---|
592 | "mov f89 = f0\n"
|
---|
593 |
|
---|
594 | "mov f90 = f0\n"
|
---|
595 | "mov f91 = f0\n"
|
---|
596 | "mov f92 = f0\n"
|
---|
597 | "mov f93 = f0\n"
|
---|
598 | "mov f94 = f0\n"
|
---|
599 | "mov f95 = f0\n"
|
---|
600 | "mov f96 = f0\n"
|
---|
601 | "mov f97 = f0\n"
|
---|
602 | "mov f98 = f0\n"
|
---|
603 | "mov f99 = f0\n"
|
---|
604 |
|
---|
605 | "mov f100 = f0\n"
|
---|
606 | "mov f101 = f0\n"
|
---|
607 | "mov f102 = f0\n"
|
---|
608 | "mov f103 = f0\n"
|
---|
609 | "mov f104 = f0\n"
|
---|
610 | "mov f105 = f0\n"
|
---|
611 | "mov f106 = f0\n"
|
---|
612 | "mov f107 = f0\n"
|
---|
613 | "mov f108 = f0\n"
|
---|
614 | "mov f109 = f0\n"
|
---|
615 |
|
---|
616 | "mov f110 = f0\n"
|
---|
617 | "mov f111 = f0\n"
|
---|
618 | "mov f112 = f0\n"
|
---|
619 | "mov f113 = f0\n"
|
---|
620 | "mov f114 = f0\n"
|
---|
621 | "mov f115 = f0\n"
|
---|
622 | "mov f116 = f0\n"
|
---|
623 | "mov f117 = f0\n"
|
---|
624 | "mov f118 = f0\n"
|
---|
625 | "mov f119 = f0\n"
|
---|
626 |
|
---|
627 | "mov f120 = f0\n"
|
---|
628 | "mov f121 = f0\n"
|
---|
629 | "mov f122 = f0\n"
|
---|
630 | "mov f123 = f0\n"
|
---|
631 | "mov f124 = f0\n"
|
---|
632 | "mov f125 = f0\n"
|
---|
633 | "mov f126 = f0\n"
|
---|
634 | "mov f127 = f0\n"
|
---|
635 | );
|
---|
636 |
|
---|
637 | }
|
---|
638 |
|
---|
639 | /** @}
|
---|
640 | */
|
---|