]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | /* |
2 | * Coyright (c) 2005-2006 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ | |
0a7de745 | 5 | * |
39236c6e A |
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. | |
0a7de745 | 14 | * |
39236c6e A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
39236c6e A |
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. | |
0a7de745 | 25 | * |
39236c6e A |
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 | ||
39236c6e A |
34 | /* |
35 | * Refer to comments in bsd/sys/munge.h | |
36 | */ | |
fe8ab488 | 37 | |
0a7de745 | 38 | static inline __attribute__((always_inline)) void |
fe8ab488 A |
39 | munge_32_to_64_unsigned(volatile uint64_t *dest, volatile uint32_t *src, int count); |
40 | ||
0a7de745 | 41 | void |
fe8ab488 | 42 | munge_w(void *args) |
39236c6e A |
43 | { |
44 | munge_32_to_64_unsigned(args, args, 1); | |
45 | } | |
46 | ||
0a7de745 | 47 | void |
fe8ab488 | 48 | munge_ww(void *args) |
39236c6e A |
49 | { |
50 | munge_32_to_64_unsigned(args, args, 2); | |
51 | } | |
52 | ||
0a7de745 | 53 | void |
fe8ab488 | 54 | munge_www(void *args) |
39236c6e A |
55 | { |
56 | munge_32_to_64_unsigned(args, args, 3); | |
57 | } | |
58 | ||
0a7de745 | 59 | void |
fe8ab488 | 60 | munge_wwww(void *args) |
39236c6e A |
61 | { |
62 | munge_32_to_64_unsigned(args, args, 4); | |
63 | } | |
64 | ||
0a7de745 | 65 | void |
fe8ab488 | 66 | munge_wwwww(void *args) |
39236c6e A |
67 | { |
68 | munge_32_to_64_unsigned(args, args, 5); | |
69 | } | |
70 | ||
0a7de745 | 71 | void |
fe8ab488 | 72 | munge_wwwwww(void *args) |
39236c6e A |
73 | { |
74 | munge_32_to_64_unsigned(args, args, 6); | |
75 | } | |
76 | ||
0a7de745 | 77 | void |
fe8ab488 | 78 | munge_wwwwwww(void *args) |
39236c6e A |
79 | { |
80 | munge_32_to_64_unsigned(args, args, 7); | |
81 | } | |
82 | ||
0a7de745 | 83 | void |
fe8ab488 | 84 | munge_wwwwwwww(void *args) |
39236c6e A |
85 | { |
86 | munge_32_to_64_unsigned(args, args, 8); | |
87 | } | |
88 | ||
0a7de745 | 89 | void |
fe8ab488 | 90 | munge_wl(void *args) |
39236c6e A |
91 | { |
92 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
93 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
94 | ||
3e170ce0 | 95 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
39236c6e A |
96 | out_args[0] = in_args[0]; |
97 | } | |
98 | ||
0a7de745 | 99 | void |
fe8ab488 | 100 | munge_wwl(void *args) |
39236c6e A |
101 | { |
102 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
103 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
104 | ||
3e170ce0 | 105 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
39236c6e A |
106 | out_args[1] = in_args[1]; |
107 | out_args[0] = in_args[0]; | |
108 | } | |
109 | ||
0a7de745 | 110 | void |
fe8ab488 | 111 | munge_wwlw(void *args) |
39236c6e A |
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]; | |
3e170ce0 | 117 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
39236c6e A |
118 | out_args[1] = in_args[1]; |
119 | out_args[0] = in_args[0]; | |
120 | } | |
0a7de745 | 121 | void |
fe8ab488 | 122 | munge_wwlll(void *args) |
39236c6e A |
123 | { |
124 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
125 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
126 | ||
3e170ce0 A |
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]; | |
39236c6e A |
130 | out_args[1] = in_args[1]; |
131 | out_args[0] = in_args[0]; | |
132 | } | |
133 | ||
134 | void | |
fe8ab488 | 135 | munge_wwllww(void *args) |
39236c6e A |
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[5] = in_args[7]; | |
141 | out_args[4] = in_args[6]; | |
3e170ce0 A |
142 | out_args[3] = *(volatile uint64_t*)&in_args[4]; |
143 | out_args[2] = *(volatile uint64_t*)&in_args[2]; | |
39236c6e A |
144 | out_args[1] = in_args[1]; |
145 | out_args[0] = in_args[0]; | |
146 | } | |
147 | ||
148 | void | |
fe8ab488 | 149 | munge_wlw(void *args) |
39236c6e A |
150 | { |
151 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
152 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
153 | ||
154 | out_args[2] = in_args[3]; | |
3e170ce0 A |
155 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
156 | out_args[0] = in_args[0]; | |
157 | } | |
158 | ||
159 | void | |
160 | munge_wlww(void *args) | |
161 | { | |
162 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
163 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
164 | ||
165 | out_args[3] = in_args[4]; | |
166 | out_args[2] = in_args[3]; | |
167 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
39236c6e A |
168 | out_args[0] = in_args[0]; |
169 | } | |
170 | ||
171 | void | |
fe8ab488 | 172 | munge_wlwwwll(void *args) |
39236c6e A |
173 | { |
174 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
175 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
176 | ||
3e170ce0 A |
177 | out_args[6] = *(volatile uint64_t*)&in_args[8]; |
178 | out_args[5] = *(volatile uint64_t*)&in_args[6]; | |
39236c6e A |
179 | out_args[4] = in_args[5]; |
180 | out_args[3] = in_args[4]; | |
181 | out_args[2] = in_args[3]; | |
3e170ce0 | 182 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
39236c6e A |
183 | out_args[0] = in_args[0]; |
184 | } | |
185 | ||
186 | void | |
fe8ab488 | 187 | munge_wlwwwllw(void *args) |
39236c6e A |
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[7] = in_args[10]; | |
fe8ab488 | 193 | munge_wlwwwll(args); |
39236c6e A |
194 | } |
195 | ||
0a7de745 | 196 | void |
fe8ab488 | 197 | munge_wlwwlwlw(void *args) |
39236c6e A |
198 | { |
199 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
200 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
201 | ||
202 | out_args[7] = in_args[10]; | |
3e170ce0 | 203 | out_args[6] = *(volatile uint64_t*)&in_args[8]; |
39236c6e | 204 | out_args[5] = in_args[7]; |
3e170ce0 | 205 | out_args[4] = *(volatile uint64_t*)&in_args[5]; |
39236c6e A |
206 | out_args[3] = in_args[4]; |
207 | out_args[2] = in_args[3]; | |
3e170ce0 | 208 | out_args[1] = *(volatile uint64_t*)&in_args[1]; |
39236c6e A |
209 | out_args[0] = in_args[0]; |
210 | } | |
211 | ||
0a7de745 | 212 | void |
fe8ab488 | 213 | munge_wll(void *args) |
39236c6e A |
214 | { |
215 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
216 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
217 | ||
3e170ce0 A |
218 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
219 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
39236c6e A |
220 | out_args[0] = in_args[0]; |
221 | } | |
222 | ||
0a7de745 | 223 | void |
fe8ab488 | 224 | munge_wlll(void *args) |
39236c6e A |
225 | { |
226 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
227 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
228 | ||
3e170ce0 A |
229 | out_args[3] = *(volatile uint64_t*)&in_args[5]; |
230 | out_args[2] = *(volatile uint64_t*)&in_args[3]; | |
231 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
a1c7dba1 A |
232 | out_args[0] = in_args[0]; |
233 | } | |
234 | ||
0a7de745 | 235 | void |
a1c7dba1 A |
236 | munge_wllll(void *args) |
237 | { | |
238 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
239 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
240 | ||
3e170ce0 A |
241 | out_args[4] = *(volatile uint64_t*)&in_args[7]; |
242 | out_args[3] = *(volatile uint64_t*)&in_args[5]; | |
243 | out_args[2] = *(volatile uint64_t*)&in_args[3]; | |
244 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
39236c6e A |
245 | out_args[0] = in_args[0]; |
246 | } | |
247 | ||
248 | void | |
fe8ab488 | 249 | munge_wllww(void *args) |
39236c6e A |
250 | { |
251 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
252 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
253 | ||
254 | out_args[4] = in_args[6]; | |
255 | out_args[3] = in_args[5]; | |
3e170ce0 A |
256 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
257 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
39236c6e A |
258 | out_args[0] = in_args[0]; |
259 | } | |
260 | ||
0a7de745 | 261 | void |
fe8ab488 | 262 | munge_wllwwll(void *args) |
39236c6e A |
263 | { |
264 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
265 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
266 | ||
3e170ce0 A |
267 | out_args[6] = *(volatile uint64_t*)&in_args[9]; |
268 | out_args[5] = *(volatile uint64_t*)&in_args[7]; | |
39236c6e A |
269 | out_args[4] = in_args[6]; |
270 | out_args[3] = in_args[5]; | |
3e170ce0 A |
271 | out_args[2] = *(volatile uint64_t*)&in_args[3]; |
272 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
39236c6e A |
273 | out_args[0] = in_args[0]; |
274 | } | |
275 | ||
0a7de745 | 276 | void |
fe8ab488 | 277 | munge_wwwlw(void *args) |
39236c6e A |
278 | { |
279 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
280 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
281 | ||
282 | out_args[4] = in_args[5]; | |
3e170ce0 | 283 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
39236c6e A |
284 | out_args[2] = in_args[2]; |
285 | out_args[1] = in_args[1]; | |
286 | out_args[0] = in_args[0]; | |
287 | } | |
288 | ||
0a7de745 | 289 | void |
fe8ab488 | 290 | munge_wwwlww(void *args) |
39236c6e A |
291 | { |
292 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
293 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
294 | ||
295 | out_args[5] = in_args[6]; | |
296 | out_args[4] = in_args[5]; | |
3e170ce0 | 297 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
39236c6e A |
298 | out_args[2] = in_args[2]; |
299 | out_args[1] = in_args[1]; | |
300 | out_args[0] = in_args[0]; | |
301 | } | |
0a7de745 A |
302 | |
303 | void | |
fe8ab488 | 304 | munge_wwwl(void *args) |
39236c6e A |
305 | { |
306 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
307 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
308 | ||
3e170ce0 | 309 | out_args[3] = *(volatile uint64_t*)&in_args[3]; |
39236c6e A |
310 | out_args[2] = in_args[2]; |
311 | out_args[1] = in_args[1]; | |
312 | out_args[0] = in_args[0]; | |
313 | } | |
314 | ||
0a7de745 | 315 | void |
fe8ab488 | 316 | munge_wwwwlw(void *args) |
39236c6e A |
317 | { |
318 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
319 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
320 | ||
321 | out_args[5] = in_args[6]; | |
3e170ce0 | 322 | out_args[4] = *(volatile uint64_t*)&in_args[4]; |
39236c6e A |
323 | out_args[3] = in_args[3]; |
324 | out_args[2] = in_args[2]; | |
325 | out_args[1] = in_args[1]; | |
326 | out_args[0] = in_args[0]; | |
327 | } | |
328 | ||
0a7de745 | 329 | void |
fe8ab488 | 330 | munge_wwwwl(void *args) |
39236c6e A |
331 | { |
332 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
333 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
334 | ||
3e170ce0 | 335 | out_args[4] = *(volatile uint64_t*)&in_args[4]; |
39236c6e A |
336 | out_args[3] = in_args[3]; |
337 | out_args[2] = in_args[2]; | |
338 | out_args[1] = in_args[1]; | |
339 | out_args[0] = in_args[0]; | |
340 | } | |
341 | ||
0a7de745 | 342 | void |
fe8ab488 | 343 | munge_wwwwwl(void *args) |
39236c6e A |
344 | { |
345 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
346 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
347 | ||
3e170ce0 | 348 | out_args[5] = *(volatile uint64_t*)&in_args[5]; |
39236c6e A |
349 | out_args[4] = in_args[4]; |
350 | out_args[3] = in_args[3]; | |
351 | out_args[2] = in_args[2]; | |
352 | out_args[1] = in_args[1]; | |
353 | out_args[0] = in_args[0]; | |
354 | } | |
355 | ||
0a7de745 | 356 | void |
fe8ab488 | 357 | munge_wwwwwlww(void *args) |
39236c6e A |
358 | { |
359 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
360 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
361 | ||
362 | out_args[7] = in_args[8]; | |
363 | out_args[6] = in_args[7]; | |
3e170ce0 | 364 | out_args[5] = *(volatile uint64_t*)&in_args[5]; |
39236c6e A |
365 | out_args[4] = in_args[4]; |
366 | out_args[3] = in_args[3]; | |
367 | out_args[2] = in_args[2]; | |
368 | out_args[1] = in_args[1]; | |
369 | out_args[0] = in_args[0]; | |
370 | } | |
371 | ||
0a7de745 | 372 | void |
fe8ab488 | 373 | munge_wwwwwllw(void *args) |
39236c6e A |
374 | { |
375 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
376 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
377 | ||
378 | out_args[7] = in_args[9]; | |
3e170ce0 A |
379 | out_args[6] = *(volatile uint64_t*)&in_args[7]; |
380 | out_args[5] = *(volatile uint64_t*)&in_args[5]; | |
39236c6e A |
381 | out_args[4] = in_args[4]; |
382 | out_args[3] = in_args[3]; | |
383 | out_args[2] = in_args[2]; | |
384 | out_args[1] = in_args[1]; | |
385 | out_args[0] = in_args[0]; | |
386 | } | |
387 | ||
0a7de745 | 388 | void |
fe8ab488 | 389 | munge_wwwwwlll(void *args) |
39236c6e A |
390 | { |
391 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
392 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
393 | ||
3e170ce0 A |
394 | out_args[7] = *(volatile uint64_t*)&in_args[9]; |
395 | out_args[6] = *(volatile uint64_t*)&in_args[7]; | |
396 | out_args[5] = *(volatile uint64_t*)&in_args[5]; | |
39236c6e A |
397 | out_args[4] = in_args[4]; |
398 | out_args[3] = in_args[3]; | |
399 | out_args[2] = in_args[2]; | |
400 | out_args[1] = in_args[1]; | |
401 | out_args[0] = in_args[0]; | |
402 | } | |
403 | ||
0a7de745 | 404 | void |
fe8ab488 | 405 | munge_wwwwwwl(void *args) |
39236c6e A |
406 | { |
407 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
408 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
409 | ||
3e170ce0 | 410 | out_args[6] = *(volatile uint64_t*)&in_args[6]; |
39236c6e A |
411 | out_args[5] = in_args[5]; |
412 | out_args[4] = in_args[4]; | |
413 | out_args[3] = in_args[3]; | |
414 | out_args[2] = in_args[2]; | |
415 | out_args[1] = in_args[1]; | |
416 | out_args[0] = in_args[0]; | |
417 | } | |
0a7de745 A |
418 | |
419 | void | |
fe8ab488 | 420 | munge_wwwwwwlw(void *args) |
39236c6e A |
421 | { |
422 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
423 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
424 | ||
425 | out_args[7] = in_args[8]; | |
3e170ce0 | 426 | out_args[6] = *(volatile uint64_t*)&in_args[6]; |
39236c6e A |
427 | out_args[5] = in_args[5]; |
428 | out_args[4] = in_args[4]; | |
429 | out_args[3] = in_args[3]; | |
430 | out_args[2] = in_args[2]; | |
431 | out_args[1] = in_args[1]; | |
432 | out_args[0] = in_args[0]; | |
433 | } | |
0a7de745 A |
434 | |
435 | void | |
fe8ab488 | 436 | munge_wwwwwwll(void *args) |
39236c6e A |
437 | { |
438 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
439 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
440 | ||
3e170ce0 A |
441 | out_args[7] = *(volatile uint64_t*)&in_args[8]; |
442 | out_args[6] = *(volatile uint64_t*)&in_args[6]; | |
39236c6e A |
443 | out_args[5] = in_args[5]; |
444 | out_args[4] = in_args[4]; | |
445 | out_args[3] = in_args[3]; | |
446 | out_args[2] = in_args[2]; | |
447 | out_args[1] = in_args[1]; | |
448 | out_args[0] = in_args[0]; | |
449 | } | |
450 | ||
0a7de745 | 451 | void |
fe8ab488 | 452 | munge_wsw(void *args) |
39236c6e A |
453 | { |
454 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
455 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
456 | ||
457 | out_args[2] = in_args[2]; | |
458 | out_args[1] = (int64_t)(int)in_args[1]; /* Sign-extend */ | |
459 | out_args[0] = in_args[0]; | |
460 | } | |
461 | ||
0a7de745 | 462 | void |
fe8ab488 | 463 | munge_wws(void *args) |
39236c6e A |
464 | { |
465 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
466 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
467 | ||
468 | out_args[2] = (int64_t)(int)in_args[2]; /* Sign-extend */ | |
469 | out_args[1] = in_args[1]; | |
470 | out_args[0] = in_args[0]; | |
471 | } | |
472 | ||
0a7de745 | 473 | void |
3e170ce0 A |
474 | munge_wwws(void *args) |
475 | { | |
476 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
477 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
478 | ||
479 | out_args[3] = (int64_t)(int)in_args[3]; /* Sign-extend */ | |
480 | out_args[2] = in_args[2]; | |
481 | out_args[1] = in_args[1]; | |
482 | out_args[0] = in_args[0]; | |
483 | } | |
484 | ||
485 | ||
486 | void | |
fe8ab488 | 487 | munge_wwwsw(void *args) |
39236c6e A |
488 | { |
489 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
490 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
491 | ||
492 | out_args[4] = in_args[4]; | |
493 | out_args[3] = (int64_t)(int)in_args[3]; /* Sign-extend */ | |
494 | out_args[2] = in_args[2]; | |
495 | out_args[1] = in_args[1]; | |
496 | out_args[0] = in_args[0]; | |
497 | } | |
498 | ||
0a7de745 | 499 | void |
fe8ab488 | 500 | munge_llllll(void *args __unused) |
39236c6e A |
501 | { |
502 | /* Nothing to do, already all 64-bit */ | |
503 | } | |
504 | ||
0a7de745 | 505 | void |
fe8ab488 | 506 | munge_ll(void *args __unused) |
39236c6e A |
507 | { |
508 | /* Nothing to do, already all 64-bit */ | |
509 | } | |
510 | ||
0a7de745 | 511 | void |
fe8ab488 | 512 | munge_l(void *args __unused) |
39236c6e A |
513 | { |
514 | /* Nothing to do, already all 64-bit */ | |
515 | } | |
516 | ||
0a7de745 | 517 | void |
fe8ab488 | 518 | munge_lw(void *args) |
39236c6e A |
519 | { |
520 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
521 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
522 | ||
523 | out_args[1] = in_args[2]; | |
3e170ce0 | 524 | out_args[0] = *(volatile uint64_t*)&in_args[0]; |
39236c6e A |
525 | } |
526 | ||
0a7de745 | 527 | void |
fe8ab488 | 528 | munge_lwww(void *args) |
39236c6e A |
529 | { |
530 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
531 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
532 | ||
0a7de745 | 533 | out_args[3] = in_args[4]; |
39236c6e A |
534 | out_args[2] = in_args[3]; |
535 | out_args[1] = in_args[2]; | |
3e170ce0 | 536 | out_args[0] = *(volatile uint64_t*)&in_args[0]; |
39236c6e A |
537 | } |
538 | ||
0a7de745 | 539 | void |
5ba3f43e A |
540 | munge_lwwwwwww(void *args) |
541 | { | |
542 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
543 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
544 | ||
545 | out_args[7] = in_args[8]; | |
0a7de745 | 546 | out_args[6] = in_args[7]; |
5ba3f43e A |
547 | out_args[5] = in_args[6]; |
548 | out_args[4] = in_args[5]; | |
0a7de745 | 549 | out_args[3] = in_args[4]; |
5ba3f43e A |
550 | out_args[2] = in_args[3]; |
551 | out_args[1] = in_args[2]; | |
552 | out_args[0] = *(volatile uint64_t*)&in_args[0]; | |
553 | } | |
554 | ||
39037602 A |
555 | void |
556 | munge_wwlww(void *args) | |
557 | { | |
558 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
559 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
560 | ||
561 | out_args[4] = in_args[5]; | |
562 | out_args[3] = in_args[4]; | |
563 | out_args[2] = *(volatile uint64_t*)&in_args[2]; | |
564 | out_args[1] = in_args[1]; | |
565 | out_args[0] = in_args[0]; | |
566 | } | |
567 | ||
39236c6e | 568 | void |
fe8ab488 | 569 | munge_wwlwww(void *args) |
39236c6e A |
570 | { |
571 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
572 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
0a7de745 | 573 | |
39236c6e A |
574 | out_args[5] = in_args[6]; |
575 | out_args[4] = in_args[5]; | |
576 | out_args[3] = in_args[4]; | |
3e170ce0 | 577 | out_args[2] = *(volatile uint64_t*)&in_args[2]; |
39236c6e A |
578 | out_args[1] = in_args[1]; |
579 | out_args[0] = in_args[0]; | |
580 | } | |
581 | ||
39037602 A |
582 | void |
583 | munge_wlwwwl(void *args) | |
584 | { | |
585 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
586 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
587 | ||
588 | out_args[5] = *(volatile uint64_t*)&in_args[6]; | |
589 | out_args[4] = in_args[5]; | |
590 | out_args[3] = in_args[4]; | |
591 | out_args[2] = in_args[3]; | |
592 | out_args[1] = *(volatile uint64_t*)&in_args[1]; | |
593 | out_args[0] = in_args[0]; | |
594 | } | |
595 | ||
596 | void | |
597 | munge_wwlwwwl(void *args) | |
598 | { | |
599 | volatile uint64_t *out_args = (volatile uint64_t*)args; | |
600 | volatile uint32_t *in_args = (volatile uint32_t*)args; | |
601 | ||
602 | out_args[6] = *(volatile uint64_t*)&in_args[7]; | |
603 | out_args[5] = in_args[6]; | |
604 | out_args[4] = in_args[5]; | |
605 | out_args[3] = in_args[4]; | |
606 | out_args[2] = *(volatile uint64_t*)&in_args[2]; | |
607 | out_args[1] = in_args[1]; | |
608 | out_args[0] = in_args[0]; | |
609 | } | |
610 | ||
39236c6e A |
611 | /* |
612 | * Munge array of 32-bit values into an array of 64-bit values, | |
0a7de745 | 613 | * without sign extension. Note, src and dest can be the same |
39236c6e A |
614 | * (copies from end of array) |
615 | */ | |
0a7de745 | 616 | static inline __attribute__((always_inline)) void |
39236c6e A |
617 | munge_32_to_64_unsigned(volatile uint64_t *dest, volatile uint32_t *src, int count) |
618 | { | |
619 | int i; | |
620 | ||
621 | for (i = count - 1; i >= 0; i--) { | |
622 | dest[i] = src[i]; | |
0a7de745 | 623 | } |
39236c6e | 624 | } |