1 | /* |
2 | * Coyright (c) 2005-2006 Apple Computer, Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | |
29 | #include <sys/cdefs.h> |
30 | #include <sys/types.h> |
31 | #include <sys/munge.h> |
32 | #include <stdint.h> |
33 | |
34 | /* |
35 | * Refer to comments in bsd/sys/munge.h |
36 | */ |
37 | |
38 | static inline __attribute__((always_inline)) void |
39 | munge_32_to_64_unsigned(volatile uint64_t *dest, volatile uint32_t *src, int count); |
40 | |
41 | void |
42 | munge_w(void *args) |
43 | { |
44 | munge_32_to_64_unsigned(dest: args, src: args, count: 1); |
45 | } |
46 | |
47 | void |
48 | munge_ww(void *args) |
49 | { |
50 | munge_32_to_64_unsigned(dest: args, src: args, count: 2); |
51 | } |
52 | |
53 | void |
54 | munge_www(void *args) |
55 | { |
56 | munge_32_to_64_unsigned(dest: args, src: args, count: 3); |
57 | } |
58 | |
59 | void |
60 | munge_wwww(void *args) |
61 | { |
62 | munge_32_to_64_unsigned(dest: args, src: args, count: 4); |
63 | } |
64 | |
65 | void |
66 | munge_wwwww(void *args) |
67 | { |
68 | munge_32_to_64_unsigned(dest: args, src: args, count: 5); |
69 | } |
70 | |
71 | void |
72 | munge_wwwwww(void *args) |
73 | { |
74 | munge_32_to_64_unsigned(dest: args, src: args, count: 6); |
75 | } |
76 | |
77 | void |
78 | munge_wwwwwww(void *args) |
79 | { |
80 | munge_32_to_64_unsigned(dest: args, src: args, count: 7); |
81 | } |
82 | |
83 | void |
84 | munge_wwwwwwww(void *args) |
85 | { |
86 | munge_32_to_64_unsigned(dest: args, src: args, count: 8); |
87 | } |
88 | |
89 | void |
90 | munge_wl(void *args) |
91 | { |
92 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
93 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
94 | |
95 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
96 | out_args[0] = in_args[0]; |
97 | } |
98 | |
99 | void |
100 | munge_wwl(void *args) |
101 | { |
102 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
103 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
104 | |
105 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
106 | out_args[1] = in_args[1]; |
107 | out_args[0] = in_args[0]; |
108 | } |
109 | |
110 | void |
111 | munge_wwlw(void *args) |
112 | { |
113 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
114 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
115 | |
116 | out_args[3] = in_args[4]; |
117 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
118 | out_args[1] = in_args[1]; |
119 | out_args[0] = in_args[0]; |
120 | } |
121 | void |
122 | munge_wwlll(void *args) |
123 | { |
124 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
125 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
126 | |
127 | out_args[4] = *(volatile uint64_t*)&in_args[6]; |
128 | out_args[3] = *(volatile uint64_t*)&in_args[4]; |
129 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
130 | out_args[1] = in_args[1]; |
131 | out_args[0] = in_args[0]; |
132 | } |
133 | |
134 | void |
135 | munge_wwlllll(void *args) |
136 | { |
137 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
138 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
139 | |
140 | out_args[6] = *(volatile uint64_t*)&in_args[10]; |
141 | out_args[5] = *(volatile uint64_t*)&in_args[8]; |
142 | out_args[4] = *(volatile uint64_t*)&in_args[6]; |
143 | out_args[3] = *(volatile uint64_t*)&in_args[4]; |
144 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
145 | out_args[1] = in_args[1]; |
146 | out_args[0] = in_args[0]; |
147 | } |
148 | |
149 | void |
150 | munge_wwllww(void *args) |
151 | { |
152 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
153 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
154 | |
155 | out_args[5] = in_args[7]; |
156 | out_args[4] = in_args[6]; |
157 | out_args[3] = *(volatile uint64_t*)&in_args[4]; |
158 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
159 | out_args[1] = in_args[1]; |
160 | out_args[0] = in_args[0]; |
161 | } |
162 | |
163 | void |
164 | munge_wlw(void *args) |
165 | { |
166 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
167 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
168 | |
169 | out_args[2] = in_args[3]; |
170 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
171 | out_args[0] = in_args[0]; |
172 | } |
173 | |
174 | void |
175 | munge_wlww(void *args) |
176 | { |
177 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
178 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
179 | |
180 | out_args[3] = in_args[4]; |
181 | out_args[2] = in_args[3]; |
182 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
183 | out_args[0] = in_args[0]; |
184 | } |
185 | |
186 | void |
187 | munge_wlwwwll(void *args) |
188 | { |
189 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
190 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
191 | |
192 | out_args[6] = *(volatile uint64_t*)&in_args[8]; |
193 | out_args[5] = *(volatile uint64_t*)&in_args[6]; |
194 | out_args[4] = in_args[5]; |
195 | out_args[3] = in_args[4]; |
196 | out_args[2] = in_args[3]; |
197 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
198 | out_args[0] = in_args[0]; |
199 | } |
200 | |
201 | void |
202 | munge_wlwwwllw(void *args) |
203 | { |
204 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
205 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
206 | |
207 | out_args[7] = in_args[10]; |
208 | munge_wlwwwll(args); |
209 | } |
210 | |
211 | void |
212 | munge_wlwwlwlw(void *args) |
213 | { |
214 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
215 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
216 | |
217 | out_args[7] = in_args[10]; |
218 | out_args[6] = *(volatile uint64_t*)&in_args[8]; |
219 | out_args[5] = in_args[7]; |
220 | out_args[4] = *(volatile uint64_t*)&in_args[5]; |
221 | out_args[3] = in_args[4]; |
222 | out_args[2] = in_args[3]; |
223 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
224 | out_args[0] = in_args[0]; |
225 | } |
226 | |
227 | void |
228 | munge_wll(void *args) |
229 | { |
230 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
231 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
232 | |
233 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
234 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
235 | out_args[0] = in_args[0]; |
236 | } |
237 | |
238 | void |
239 | munge_wlll(void *args) |
240 | { |
241 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
242 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
243 | |
244 | out_args[3] = *(volatile uint64_t*)&in_args[5]; |
245 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
246 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
247 | out_args[0] = in_args[0]; |
248 | } |
249 | |
250 | void |
251 | munge_wlllww(void *args) |
252 | { |
253 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
254 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
255 | |
256 | out_args[5] = in_args[8]; |
257 | out_args[4] = in_args[7]; |
258 | out_args[3] = *(volatile uint64_t*)&in_args[5]; |
259 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
260 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
261 | out_args[0] = in_args[0]; |
262 | } |
263 | |
264 | void |
265 | munge_wllll(void *args) |
266 | { |
267 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
268 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
269 | |
270 | out_args[4] = *(volatile uint64_t*)&in_args[7]; |
271 | out_args[3] = *(volatile uint64_t*)&in_args[5]; |
272 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
273 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
274 | out_args[0] = in_args[0]; |
275 | } |
276 | |
277 | void |
278 | munge_wllww(void *args) |
279 | { |
280 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
281 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
282 | |
283 | out_args[4] = in_args[6]; |
284 | out_args[3] = in_args[5]; |
285 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
286 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
287 | out_args[0] = in_args[0]; |
288 | } |
289 | |
290 | void |
291 | munge_wllwwll(void *args) |
292 | { |
293 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
294 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
295 | |
296 | out_args[6] = *(volatile uint64_t*)&in_args[9]; |
297 | out_args[5] = *(volatile uint64_t*)&in_args[7]; |
298 | out_args[4] = in_args[6]; |
299 | out_args[3] = in_args[5]; |
300 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
301 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
302 | out_args[0] = in_args[0]; |
303 | } |
304 | |
305 | void |
306 | munge_wwwlw(void *args) |
307 | { |
308 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
309 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
310 | |
311 | out_args[4] = in_args[5]; |
312 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
313 | out_args[2] = in_args[2]; |
314 | out_args[1] = in_args[1]; |
315 | out_args[0] = in_args[0]; |
316 | } |
317 | |
318 | void |
319 | munge_wwwlww(void *args) |
320 | { |
321 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
322 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
323 | |
324 | out_args[5] = in_args[6]; |
325 | out_args[4] = in_args[5]; |
326 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
327 | out_args[2] = in_args[2]; |
328 | out_args[1] = in_args[1]; |
329 | out_args[0] = in_args[0]; |
330 | } |
331 | |
332 | void |
333 | munge_wwwlwww(void *args) |
334 | { |
335 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
336 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
337 | |
338 | out_args[6] = in_args[7]; |
339 | out_args[5] = in_args[6]; |
340 | out_args[4] = in_args[5]; |
341 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
342 | out_args[2] = in_args[2]; |
343 | out_args[1] = in_args[1]; |
344 | out_args[0] = in_args[0]; |
345 | } |
346 | |
347 | void |
348 | munge_wwwl(void *args) |
349 | { |
350 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
351 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
352 | |
353 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
354 | out_args[2] = in_args[2]; |
355 | out_args[1] = in_args[1]; |
356 | out_args[0] = in_args[0]; |
357 | } |
358 | |
359 | void |
360 | munge_wwwwlw(void *args) |
361 | { |
362 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
363 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
364 | |
365 | out_args[5] = in_args[6]; |
366 | out_args[4] = *(volatile uint64_t*)&in_args[4]; |
367 | out_args[3] = in_args[3]; |
368 | out_args[2] = in_args[2]; |
369 | out_args[1] = in_args[1]; |
370 | out_args[0] = in_args[0]; |
371 | } |
372 | |
373 | void |
374 | munge_wwwwllww(void *args) |
375 | { |
376 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
377 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
378 | |
379 | out_args[7] = in_args[9]; |
380 | out_args[6] = in_args[8]; |
381 | out_args[5] = *(volatile uint64_t*)&in_args[6]; |
382 | out_args[4] = *(volatile uint64_t*)&in_args[4]; |
383 | out_args[3] = in_args[3]; |
384 | out_args[2] = in_args[2]; |
385 | out_args[1] = in_args[1]; |
386 | out_args[0] = in_args[0]; |
387 | } |
388 | |
389 | void |
390 | munge_wwwwl(void *args) |
391 | { |
392 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
393 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
394 | |
395 | out_args[4] = *(volatile uint64_t*)&in_args[4]; |
396 | out_args[3] = in_args[3]; |
397 | out_args[2] = in_args[2]; |
398 | out_args[1] = in_args[1]; |
399 | out_args[0] = in_args[0]; |
400 | } |
401 | |
402 | void |
403 | munge_wwwwwl(void *args) |
404 | { |
405 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
406 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
407 | |
408 | out_args[5] = *(volatile uint64_t*)&in_args[5]; |
409 | out_args[4] = in_args[4]; |
410 | out_args[3] = in_args[3]; |
411 | out_args[2] = in_args[2]; |
412 | out_args[1] = in_args[1]; |
413 | out_args[0] = in_args[0]; |
414 | } |
415 | |
416 | void |
417 | munge_wwwwwlww(void *args) |
418 | { |
419 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
420 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
421 | |
422 | out_args[7] = in_args[8]; |
423 | out_args[6] = in_args[7]; |
424 | out_args[5] = *(volatile uint64_t*)&in_args[5]; |
425 | out_args[4] = in_args[4]; |
426 | out_args[3] = in_args[3]; |
427 | out_args[2] = in_args[2]; |
428 | out_args[1] = in_args[1]; |
429 | out_args[0] = in_args[0]; |
430 | } |
431 | |
432 | void |
433 | munge_wwwwwllw(void *args) |
434 | { |
435 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
436 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
437 | |
438 | out_args[7] = in_args[9]; |
439 | out_args[6] = *(volatile uint64_t*)&in_args[7]; |
440 | out_args[5] = *(volatile uint64_t*)&in_args[5]; |
441 | out_args[4] = in_args[4]; |
442 | out_args[3] = in_args[3]; |
443 | out_args[2] = in_args[2]; |
444 | out_args[1] = in_args[1]; |
445 | out_args[0] = in_args[0]; |
446 | } |
447 | |
448 | void |
449 | munge_wwwwwlll(void *args) |
450 | { |
451 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
452 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
453 | |
454 | out_args[7] = *(volatile uint64_t*)&in_args[9]; |
455 | out_args[6] = *(volatile uint64_t*)&in_args[7]; |
456 | out_args[5] = *(volatile uint64_t*)&in_args[5]; |
457 | out_args[4] = in_args[4]; |
458 | out_args[3] = in_args[3]; |
459 | out_args[2] = in_args[2]; |
460 | out_args[1] = in_args[1]; |
461 | out_args[0] = in_args[0]; |
462 | } |
463 | |
464 | void |
465 | munge_wwwwwwl(void *args) |
466 | { |
467 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
468 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
469 | |
470 | out_args[6] = *(volatile uint64_t*)&in_args[6]; |
471 | out_args[5] = in_args[5]; |
472 | out_args[4] = in_args[4]; |
473 | out_args[3] = in_args[3]; |
474 | out_args[2] = in_args[2]; |
475 | out_args[1] = in_args[1]; |
476 | out_args[0] = in_args[0]; |
477 | } |
478 | |
479 | void |
480 | munge_wwwwwwlw(void *args) |
481 | { |
482 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
483 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
484 | |
485 | out_args[7] = in_args[8]; |
486 | out_args[6] = *(volatile uint64_t*)&in_args[6]; |
487 | out_args[5] = in_args[5]; |
488 | out_args[4] = in_args[4]; |
489 | out_args[3] = in_args[3]; |
490 | out_args[2] = in_args[2]; |
491 | out_args[1] = in_args[1]; |
492 | out_args[0] = in_args[0]; |
493 | } |
494 | |
495 | void |
496 | munge_wwwwwwll(void *args) |
497 | { |
498 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
499 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
500 | |
501 | out_args[7] = *(volatile uint64_t*)&in_args[8]; |
502 | out_args[6] = *(volatile uint64_t*)&in_args[6]; |
503 | out_args[5] = in_args[5]; |
504 | out_args[4] = in_args[4]; |
505 | out_args[3] = in_args[3]; |
506 | out_args[2] = in_args[2]; |
507 | out_args[1] = in_args[1]; |
508 | out_args[0] = in_args[0]; |
509 | } |
510 | |
511 | void |
512 | munge_wsw(void *args) |
513 | { |
514 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
515 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
516 | |
517 | out_args[2] = in_args[2]; |
518 | out_args[1] = (int64_t)(int)in_args[1]; /* Sign-extend */ |
519 | out_args[0] = in_args[0]; |
520 | } |
521 | |
522 | void |
523 | munge_wws(void *args) |
524 | { |
525 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
526 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
527 | |
528 | out_args[2] = (int64_t)(int)in_args[2]; /* Sign-extend */ |
529 | out_args[1] = in_args[1]; |
530 | out_args[0] = in_args[0]; |
531 | } |
532 | |
533 | void |
534 | munge_wwws(void *args) |
535 | { |
536 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
537 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
538 | |
539 | out_args[3] = (int64_t)(int)in_args[3]; /* Sign-extend */ |
540 | out_args[2] = in_args[2]; |
541 | out_args[1] = in_args[1]; |
542 | out_args[0] = in_args[0]; |
543 | } |
544 | |
545 | |
546 | void |
547 | munge_wwwsw(void *args) |
548 | { |
549 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
550 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
551 | |
552 | out_args[4] = in_args[4]; |
553 | out_args[3] = (int64_t)(int)in_args[3]; /* Sign-extend */ |
554 | out_args[2] = in_args[2]; |
555 | out_args[1] = in_args[1]; |
556 | out_args[0] = in_args[0]; |
557 | } |
558 | |
559 | void |
560 | munge_llllllll(void *args __unused) |
561 | { |
562 | /* Nothing to do, already all 64-bit */ |
563 | } |
564 | |
565 | void |
566 | munge_llllll(void *args __unused) |
567 | { |
568 | /* Nothing to do, already all 64-bit */ |
569 | } |
570 | |
571 | void |
572 | munge_llll(void *args __unused) |
573 | { |
574 | /* Nothing to do, already all 64-bit */ |
575 | } |
576 | |
577 | void |
578 | munge_lll(void *args __unused) |
579 | { |
580 | /* Nothing to do, already all 64-bit */ |
581 | } |
582 | |
583 | void |
584 | munge_ll(void *args __unused) |
585 | { |
586 | /* Nothing to do, already all 64-bit */ |
587 | } |
588 | |
589 | void |
590 | munge_l(void *args __unused) |
591 | { |
592 | /* Nothing to do, already all 64-bit */ |
593 | } |
594 | |
595 | void |
596 | munge_lw(void *args) |
597 | { |
598 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
599 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
600 | |
601 | out_args[1] = in_args[2]; |
602 | out_args[0] = *(volatile uint64_t*)&in_args[0]; |
603 | } |
604 | |
605 | void |
606 | munge_lwww(void *args) |
607 | { |
608 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
609 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
610 | |
611 | out_args[3] = in_args[4]; |
612 | out_args[2] = in_args[3]; |
613 | out_args[1] = in_args[2]; |
614 | out_args[0] = *(volatile uint64_t*)&in_args[0]; |
615 | } |
616 | |
617 | void |
618 | munge_lwwwwwww(void *args) |
619 | { |
620 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
621 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
622 | |
623 | out_args[7] = in_args[8]; |
624 | out_args[6] = in_args[7]; |
625 | out_args[5] = in_args[6]; |
626 | out_args[4] = in_args[5]; |
627 | out_args[3] = in_args[4]; |
628 | out_args[2] = in_args[3]; |
629 | out_args[1] = in_args[2]; |
630 | out_args[0] = *(volatile uint64_t*)&in_args[0]; |
631 | } |
632 | |
633 | void |
634 | munge_wwlww(void *args) |
635 | { |
636 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
637 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
638 | |
639 | out_args[4] = in_args[5]; |
640 | out_args[3] = in_args[4]; |
641 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
642 | out_args[1] = in_args[1]; |
643 | out_args[0] = in_args[0]; |
644 | } |
645 | |
646 | void |
647 | munge_wwlwww(void *args) |
648 | { |
649 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
650 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
651 | |
652 | out_args[5] = in_args[6]; |
653 | out_args[4] = in_args[5]; |
654 | out_args[3] = in_args[4]; |
655 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
656 | out_args[1] = in_args[1]; |
657 | out_args[0] = in_args[0]; |
658 | } |
659 | |
660 | void |
661 | munge_wlwwwl(void *args) |
662 | { |
663 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
664 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
665 | |
666 | out_args[5] = *(volatile uint64_t*)&in_args[6]; |
667 | out_args[4] = in_args[5]; |
668 | out_args[3] = in_args[4]; |
669 | out_args[2] = in_args[3]; |
670 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
671 | out_args[0] = in_args[0]; |
672 | } |
673 | |
674 | void |
675 | munge_wwlwwwl(void *args) |
676 | { |
677 | volatile uint64_t *out_args = (volatile uint64_t*)args; |
678 | volatile uint32_t *in_args = (volatile uint32_t*)args; |
679 | |
680 | out_args[6] = *(volatile uint64_t*)&in_args[7]; |
681 | out_args[5] = in_args[6]; |
682 | out_args[4] = in_args[5]; |
683 | out_args[3] = in_args[4]; |
684 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
685 | out_args[1] = in_args[1]; |
686 | out_args[0] = in_args[0]; |
687 | } |
688 | |
689 | /* |
690 | * Munge array of 32-bit values into an array of 64-bit values, |
691 | * without sign extension. Note, src and dest can be the same |
692 | * (copies from end of array) |
693 | */ |
694 | static inline __attribute__((always_inline)) void |
695 | munge_32_to_64_unsigned(volatile uint64_t *dest, volatile uint32_t *src, int count) |
696 | { |
697 | int i; |
698 | |
699 | for (i = count - 1; i >= 0; i--) { |
700 | dest[i] = src[i]; |
701 | } |
702 | } |
703 | |