]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/arm/munge.c
af050d7ee4117c61ec8c5e0a8a559fdb5df8153a
2 * Coyright (c) 2005-2015 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 * For arm32 ABI where 64-bit types are aligned to even registers and
31 * 64-bits on stack, we need to unpack registers differently. So
32 * we use the mungers for that. Currently this is just ARMv7k.
34 * Since arm32 has no need for munging otherwise, we don't include
35 * any of this for other arm32 ABIs
37 #if __arm__ && (__BIGGEST_ALIGNMENT__ > 4)
39 #include <sys/munge.h>
40 #include <sys/param.h>
41 #include <mach/thread_status.h>
42 #include <libkern/libkern.h>
47 * Userspace args are in r0-r6, then r8, then stack unless this is an
48 * indirect call in which case the syscall number is in r0 then args
49 * are in registers r1-r6, then r8, then stack. This is for mach and
54 #define SS_TO_STYLE(ss) ((ss->r[12] != 0) ? kDirect : kIndirect)
55 #define REGS_TO_STYLE(regs) (SS_TO_STYLE(((const arm_saved_state_t *)regs)))
62 #define DECLARE_AND_CAST(regs, args, ss, uu_args) const arm_saved_state_t *ss = (const arm_saved_state_t *)regs; \
63 uint32_t *uu_args = (uint32_t *)args;
66 * We start 32 bytes after sp since 4 registers are pushed onto the stack
67 * in the userspace syscall handler, and the first 4 stack argumnets are moved
68 * into registers already
70 #define ARG_SP_BYTE_OFFSET 32
74 * Marshal in arguments from userspace where no padding exists
78 marshal_no_pad(const arm_saved_state_t
*ss
, uint32_t *args
, const uint32_t word_count
)
81 /* init assuming kDirect style */
82 uint32_t copy_count
, contiguous_reg_count
= 7, contiguous_reg_start
= 0;
83 style_t style
= SS_TO_STYLE(ss
);
85 if (style
== kIndirect
) {
86 contiguous_reg_count
--;
87 contiguous_reg_start
++;
91 copy_count
= MIN(word_count
, contiguous_reg_count
);
92 memcpy(args
, &(ss
->r
[contiguous_reg_start
]), copy_count
* sizeof(uint32_t));
95 if (word_count
> copy_count
) {
102 if (word_count
> copy_count
) {
103 error
= copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
,
104 args
, (word_count
- copy_count
) * sizeof(uint32_t));
114 * Define mungers to marshal userspace data into argument structs
118 munge_w(const void *regs
, void *args
)
120 return marshal_no_pad(regs
, args
, 1);
124 munge_ww(const void *regs
, void *args
)
126 return marshal_no_pad(regs
, args
, 2);
130 munge_www(const void *regs
, void *args
)
132 return marshal_no_pad(regs
, args
, 3);
136 munge_wwww(const void *regs
, void *args
)
138 return marshal_no_pad(regs
, args
, 4);
142 munge_wwwww(const void *regs
, void *args
)
144 return marshal_no_pad(regs
, args
, 5);
148 munge_wwwwww(const void *regs
, void *args
)
150 return marshal_no_pad(regs
, args
, 6);
154 munge_wwwwwww(const void *regs
, void *args
)
156 return marshal_no_pad(regs
, args
, 7);
160 munge_wwwwwwww(const void *regs
, void *args
)
162 return marshal_no_pad(regs
, args
, 8);
166 munge_wwl(const void *regs
, void *args
)
168 if (REGS_TO_STYLE(regs
) == kDirect
) {
169 return marshal_no_pad(regs
, args
, 4);
171 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
173 uu_args
[0] = ss
->r
[1]; // w
174 uu_args
[1] = ss
->r
[2]; // w
175 uu_args
[2] = ss
->r
[4]; // l (longs are aligned to even registers for armv7k, so skip r3)
176 uu_args
[3] = ss
->r
[5]; //
182 munge_wwlw(const void *regs
, void *args
)
184 if (REGS_TO_STYLE(regs
) == kDirect
) {
185 return marshal_no_pad(regs
, args
, 5);
187 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
189 int error
= munge_wwl(regs
, args
); // wwl
190 uu_args
[4] = ss
->r
[6]; // w
196 munge_wwlww(const void *regs
, void *args
)
198 if (REGS_TO_STYLE(regs
) == kDirect
) {
199 // the long-long here is aligned on an even register
200 // so there shouldn't be any padding
201 return marshal_no_pad(regs
, args
, 6);
203 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
205 int error
= munge_wwlw(regs
, args
); // wwlw
206 uu_args
[5] = ss
->r
[8]; // w
212 munge_wwlll(const void *regs
, void *args
)
214 if (REGS_TO_STYLE(regs
) == kDirect
) {
215 return marshal_no_pad(regs
, args
, 8);
217 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
219 int error
= munge_wwl(regs
, args
); // wwl
223 uu_args
[4] = ss
->r
[6]; // l
224 uu_args
[5] = ss
->r
[8]; //
225 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // l
226 &(uu_args
[6]), 2 * sizeof(uint32_t));
231 munge_wwllww(const void *regs
, void *args
)
233 return munge_wwlll(regs
, args
);
237 munge_wl(const void *regs
, void *args
)
239 if (REGS_TO_STYLE(regs
) == kDirect
) {
240 memcpy(args
, regs
, 4 * sizeof(uint32_t));
242 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
244 uu_args
[0] = ss
->r
[1]; // w
245 uu_args
[2] = ss
->r
[2]; // l
246 uu_args
[3] = ss
->r
[3]; //
252 munge_wlw(const void *regs
, void *args
)
254 if (REGS_TO_STYLE(regs
) == kDirect
) {
255 memcpy(args
, regs
, 5 * sizeof(uint32_t));
257 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
259 uu_args
[0] = ss
->r
[1]; // w
260 uu_args
[2] = ss
->r
[2]; // l
261 uu_args
[3] = ss
->r
[3]; //
262 uu_args
[4] = ss
->r
[4]; // w
268 munge_wlww(const void *regs
, void *args
)
270 if (REGS_TO_STYLE(regs
) == kDirect
) {
271 memcpy(args
, regs
, 6 * sizeof(uint32_t));
273 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
275 uu_args
[0] = ss
->r
[1]; // w
276 uu_args
[2] = ss
->r
[2]; // l
277 uu_args
[3] = ss
->r
[3]; //
278 uu_args
[4] = ss
->r
[4]; // w
279 uu_args
[5] = ss
->r
[5]; // w
285 munge_wlwwwll(const void *regs
, void *args
)
287 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
289 if (REGS_TO_STYLE(regs
) == kDirect
) {
290 memcpy(args
, regs
, 7 * sizeof(uint32_t)); // wlwww
291 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ll
292 uu_args
+ 8, 4 * sizeof(uint32_t));
294 uu_args
[0] = ss
->r
[1]; // w
295 uu_args
[2] = ss
->r
[2]; // l
296 uu_args
[3] = ss
->r
[3]; //
297 uu_args
[4] = ss
->r
[4]; // w
298 uu_args
[5] = ss
->r
[5]; // w
299 uu_args
[6] = ss
->r
[6]; // w
300 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ll
301 uu_args
+ 8, 4 * sizeof(uint32_t));
306 munge_wlwwwllw(const void *regs
, void *args
)
308 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
310 if (REGS_TO_STYLE(regs
) == kDirect
) {
311 memcpy(args
, regs
, 7 * sizeof(uint32_t)); // wlwww
312 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
,
313 uu_args
+ 8, 5 * sizeof(uint32_t)); // ll
315 uu_args
[0] = ss
->r
[1]; // w
316 uu_args
[2] = ss
->r
[2]; // l
317 uu_args
[3] = ss
->r
[3]; //
318 uu_args
[4] = ss
->r
[4]; // w
319 uu_args
[5] = ss
->r
[5]; // w
320 uu_args
[6] = ss
->r
[6]; // w
321 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // llw
322 uu_args
+ 8, 5 * sizeof(uint32_t));
327 munge_wlwwlwlw(const void *regs
, void *args
)
329 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
331 if (REGS_TO_STYLE(regs
) == kDirect
) {
332 uu_args
[0] = ss
->r
[0]; // w
334 uu_args
[0] = ss
->r
[1]; // w
336 uu_args
[2] = ss
->r
[2]; // l
337 uu_args
[3] = ss
->r
[3]; //
338 uu_args
[4] = ss
->r
[4]; // w
339 uu_args
[5] = ss
->r
[5]; // w
340 uu_args
[6] = ss
->r
[6]; // l
341 uu_args
[7] = ss
->r
[8]; //
342 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // wlw
343 uu_args
+ 8, 5 * sizeof(uint32_t));
347 munge_wll(const void *regs
, void *args
)
349 if (REGS_TO_STYLE(regs
) == kDirect
) {
350 memcpy(args
, regs
, 6 * sizeof(uint32_t));
352 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
354 uu_args
[0] = ss
->r
[1]; // w
355 uu_args
[2] = ss
->r
[2]; // l
356 uu_args
[3] = ss
->r
[3]; //
357 uu_args
[4] = ss
->r
[4]; // l
358 uu_args
[5] = ss
->r
[5]; //
364 munge_wlll(const void *regs
, void *args
)
366 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
368 int error
= munge_wll(regs
, args
); // wll
369 uu_args
[6] = ss
->r
[6]; // l
370 uu_args
[7] = ss
->r
[8]; //
375 munge_wlllww(const void *regs
, void *args
)
377 return munge_wllll(regs
, args
);
381 munge_wllll(const void *regs
, void *args
)
383 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
385 munge_wlll(regs
, args
); // wlll
386 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // l
387 uu_args
+ 8, 2 * sizeof(uint32_t));
391 munge_wllww(const void *regs
, void *args
)
393 return munge_wlll(regs
, args
);
397 munge_wllwwll(const void *regs
, void *args
)
399 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
401 int error
= munge_wlll(regs
, args
); // wllww
405 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ll
406 uu_args
+ 8, 4 * sizeof(uint32_t));
410 munge_wwwlw(const void *regs
, void *args
)
412 if (REGS_TO_STYLE(regs
) == kDirect
) {
413 memcpy(args
, regs
, 7 * sizeof(uint32_t));
415 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
417 uu_args
[0] = ss
->r
[1]; // w
418 uu_args
[1] = ss
->r
[2]; // w
419 uu_args
[2] = ss
->r
[3]; // w
420 uu_args
[4] = ss
->r
[4]; // l
421 uu_args
[5] = ss
->r
[5]; //
422 uu_args
[6] = ss
->r
[6]; // w
428 munge_wwwlww(const void *regs
, void *args
)
430 if (REGS_TO_STYLE(regs
) == kDirect
) {
431 return munge_wlll(regs
, args
);
433 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
435 uu_args
[0] = ss
->r
[1]; // w
436 uu_args
[1] = ss
->r
[2]; // w
437 uu_args
[2] = ss
->r
[3]; // w
438 uu_args
[4] = ss
->r
[4]; // l
439 uu_args
[5] = ss
->r
[5]; //
440 uu_args
[6] = ss
->r
[6]; // w
441 uu_args
[7] = ss
->r
[8]; // w
447 munge_wwwlwww(const void *regs
, void *args
)
449 if (REGS_TO_STYLE(regs
) == kDirect
) {
450 memcpy(args
, regs
, 9 * sizeof(uint32_t));
452 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
454 uu_args
[0] = ss
->r
[1]; // w
455 uu_args
[1] = ss
->r
[2]; // w
456 uu_args
[2] = ss
->r
[3]; // w
457 uu_args
[4] = ss
->r
[4]; // l
458 uu_args
[5] = ss
->r
[5]; //
459 uu_args
[6] = ss
->r
[6]; // w
460 uu_args
[7] = ss
->r
[7]; // w
461 uu_args
[8] = ss
->r
[8]; // w
467 munge_wwwl(const void *regs
, void *args
)
469 if (REGS_TO_STYLE(regs
) == kDirect
) {
470 return munge_wll(regs
, args
);
472 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
474 uu_args
[0] = ss
->r
[1]; // w
475 uu_args
[1] = ss
->r
[2]; // w
476 uu_args
[2] = ss
->r
[3]; // w
477 uu_args
[4] = ss
->r
[4]; // l
478 uu_args
[5] = ss
->r
[5]; //
484 munge_wwwwl(const void *regs
, void *args
)
486 if (REGS_TO_STYLE(regs
) == kDirect
) {
487 return marshal_no_pad(regs
, args
, 6);
489 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
491 uu_args
[0] = ss
->r
[1]; // w
492 uu_args
[1] = ss
->r
[2]; // w
493 uu_args
[2] = ss
->r
[3]; // w
494 uu_args
[3] = ss
->r
[4]; // w
495 uu_args
[4] = ss
->r
[6]; // l
496 uu_args
[5] = ss
->r
[8]; //
502 munge_wwwwlw(const void *regs
, void *args
)
504 if (REGS_TO_STYLE(regs
) == kDirect
) {
505 return marshal_no_pad(regs
, args
, 7);
507 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
509 int error
= munge_wwwwl(regs
, args
); // wwwwl
513 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // w
514 uu_args
+ 6, sizeof(uint32_t));
519 munge_wwwwllww(const void *regs
, void *args
)
521 if (REGS_TO_STYLE(regs
) == kDirect
) {
522 return marshal_no_pad(regs
, args
, 10);
524 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
525 int error
= munge_wwwwl(regs
, args
); // wwwwl
529 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // lww
530 uu_args
+ 6, 4 * sizeof(uint32_t));
535 munge_wwwwwl(const void *regs
, void *args
)
537 if (REGS_TO_STYLE(regs
) == kDirect
) {
538 return munge_wlll(regs
, args
);
540 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
542 uu_args
[0] = ss
->r
[1]; // w
543 uu_args
[1] = ss
->r
[2]; // w
544 uu_args
[2] = ss
->r
[3]; // w
545 uu_args
[3] = ss
->r
[4]; // w
546 uu_args
[4] = ss
->r
[5]; // w
547 uu_args
[6] = ss
->r
[6]; // l
548 uu_args
[7] = ss
->r
[8]; //
554 munge_wwwwwlww(const void *regs
, void *args
)
556 if (REGS_TO_STYLE(regs
) == kDirect
) {
557 return munge_wllll(regs
, args
);
559 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
561 int error
= munge_wwwwwl(regs
, args
); // wwwwwl
565 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ww
566 uu_args
+ 8, 2 * sizeof(uint32_t));
571 munge_wwwwwllw(const void *regs
, void *args
)
573 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
575 int error
= munge_wwwwwl(regs
, args
); // wwwwwl
579 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // lw
580 uu_args
+ 8, 3 * sizeof(uint32_t));
584 munge_wwwwwlll(const void *regs
, void *args
)
586 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
589 if (REGS_TO_STYLE(regs
) == kDirect
) {
590 error
= munge_wlll(regs
, args
); // wlll
594 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ll
595 uu_args
+ 8, 4 * sizeof(uint32_t));
597 error
= munge_wwwwwl(regs
, args
); // wwwwwl
601 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ll
602 uu_args
+ 8, 4 * sizeof(uint32_t));
607 munge_wwwwwwl(const void *regs
, void *args
)
609 munge_wwlll(regs
, args
);
611 if (REGS_TO_STYLE(regs
) == kDirect
) {
612 return marshal_no_pad(regs
, args
, 8);
614 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
616 memcpy(args
, &(ss
->r
[1]), 6 * sizeof(uint32_t)); // wwwwww
617 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // l
618 &(uu_args
[6]), 2 * sizeof(uint32_t));
623 munge_wwwwwwlw(const void *regs
, void *args
)
625 if (REGS_TO_STYLE(regs
) == kDirect
) {
626 return marshal_no_pad(regs
, args
, 9);
628 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
630 memcpy(args
, &(ss
->r
[1]), 6 * sizeof(uint32_t)); // wwwwww
631 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // lw
632 &(uu_args
[6]), 3 * sizeof(uint32_t));
637 munge_wwwwwwll(const void *regs
, void *args
)
639 if (REGS_TO_STYLE(regs
) == kDirect
) {
640 return marshal_no_pad(regs
, args
, 10);
642 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
644 memcpy(args
, &(ss
->r
[1]), 6 * sizeof(uint32_t)); // wwwwww
645 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // ll
646 &(uu_args
[6]), 4 * sizeof(uint32_t));
651 munge_wsw(const void *regs
, void *args
)
653 return munge_wlw(regs
, args
);
657 munge_wws(const void *regs
, void *args
)
659 return munge_wwl(regs
, args
);
663 munge_wwws(const void *regs
, void *args
)
665 return munge_wwwl(regs
, args
);
669 munge_wwwsw(const void *regs
, void *args
)
671 return munge_wwwlw(regs
, args
);
675 munge_llllll(const void *regs
, void *args
)
677 if (REGS_TO_STYLE(regs
) == kDirect
) {
678 return marshal_no_pad(regs
, args
, 12);
680 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
682 uu_args
[0] = ss
->r
[2]; // l
683 uu_args
[1] = ss
->r
[3]; //
684 uu_args
[2] = ss
->r
[4]; // l
685 uu_args
[3] = ss
->r
[5]; //
686 uu_args
[4] = ss
->r
[6]; // l
687 uu_args
[5] = ss
->r
[8]; //
688 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // lll
689 uu_args
+ 6, 6 * sizeof(uint32_t));
694 munge_ll(const void *regs
, void *args
)
696 if (REGS_TO_STYLE(regs
) == kDirect
) {
697 return marshal_no_pad(regs
, args
, 4);
699 memcpy(args
, (const uint32_t*)regs
+ 2, 4 * sizeof(uint32_t));
705 munge_l(const void *regs
, void *args
)
707 if (REGS_TO_STYLE(regs
) == kDirect
) {
708 return marshal_no_pad(regs
, args
, 2);
710 memcpy(args
, (const uint32_t*)regs
+ 2, 2 * sizeof(uint32_t));
716 munge_lw(const void *regs
, void *args
)
718 if (REGS_TO_STYLE(regs
) == kDirect
) {
719 return marshal_no_pad(regs
, args
, 3);
721 memcpy(args
, (const uint32_t*)regs
+ 2, 3 * sizeof(uint32_t));
727 munge_lwww(const void *regs
, void *args
)
729 if (REGS_TO_STYLE(regs
) == kDirect
) {
730 return marshal_no_pad(regs
, args
, 5);
732 memcpy(args
, (const uint32_t*)regs
+ 2, 5 * sizeof(uint32_t));
738 munge_lwwwwwww(const void *regs
, void *args
)
740 if (REGS_TO_STYLE(regs
) == kDirect
) {
741 return marshal_no_pad(regs
, args
, 9);
743 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
745 uu_args
[0] = ss
->r
[2]; // l
746 uu_args
[1] = ss
->r
[3]; //
747 uu_args
[2] = ss
->r
[4]; // w
748 uu_args
[3] = ss
->r
[5]; // w
749 uu_args
[4] = ss
->r
[6]; // w
750 uu_args
[5] = ss
->r
[8]; // w
751 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // www
752 uu_args
+ 6, 3 * sizeof(uint32_t));
757 munge_wwlwww(const void *regs
, void *args
)
759 if (REGS_TO_STYLE(regs
) == kDirect
) {
760 return marshal_no_pad(regs
, args
, 7);
762 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
764 uu_args
[0] = ss
->r
[1]; // w
765 uu_args
[1] = ss
->r
[2]; // w
766 uu_args
[2] = ss
->r
[4]; // l
767 uu_args
[3] = ss
->r
[5]; //
768 uu_args
[4] = ss
->r
[6]; // w
769 uu_args
[5] = ss
->r
[8]; // w
770 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // w
771 uu_args
+ 6, sizeof(uint32_t));
776 munge_wlwwwl(const void *regs
, void *args
)
778 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
780 if (REGS_TO_STYLE(regs
) == kDirect
) {
781 memcpy(args
, regs
, 7 * sizeof(uint32_t)); // wlwww
782 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // l
783 uu_args
+ 8, 2 * sizeof(uint32_t));
785 uu_args
[0] = ss
->r
[1]; // w
786 uu_args
[2] = ss
->r
[2]; // l
787 uu_args
[3] = ss
->r
[3]; //
788 uu_args
[4] = ss
->r
[4]; // w
789 uu_args
[5] = ss
->r
[5]; // w
790 uu_args
[6] = ss
->r
[6]; // w
791 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // l
792 uu_args
+ 8, 2 * sizeof(uint32_t));
797 munge_wwlwwwl(const void *regs
, void *args
)
799 DECLARE_AND_CAST(regs
, args
, ss
, uu_args
);
801 if (REGS_TO_STYLE(regs
) == kDirect
) {
802 memcpy(args
, regs
, 7 * sizeof(uint32_t)); // wwlwww
803 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // l
804 uu_args
+ 8, 2 * sizeof(uint32_t));
806 uu_args
[0] = ss
->r
[1]; // w
807 uu_args
[1] = ss
->r
[2]; // w
808 uu_args
[2] = ss
->r
[4]; // l
809 uu_args
[3] = ss
->r
[5]; //
810 uu_args
[4] = ss
->r
[6]; // w
811 uu_args
[5] = ss
->r
[8]; // w
812 return copyin(ss
->sp
+ ARG_SP_BYTE_OFFSET
, // wl
813 uu_args
+ 6, 4 * sizeof(uint32_t));
817 #endif // __arm__ && (__BIGGEST_ALIGNMENT__ > 4)