2 * Copyright (c) 2004 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 * Syscall argument mungers.
32 * Passed a pointer to the users register array in the savearea, we copy args into
33 * the uu_arg[] array, padding etc as appropriate. The issue is that parameters
34 * passed in registers from a 32-bit address space do not map directly into the uu_args.
35 * For example, a 32-bit long-long comes in two registers, but we need to combine
36 * them into one 64-bit long-long in the uu_args.
38 * There are several functions in this file. Each takes two parameters:
40 * void munge_XXXX( const void *regs, void *uu_args);
42 * The name of the function encodes the number and type of the parameters, as follows:
44 * w = a 32-bit value such as an int or a 32-bit ptr, that does not require
45 * sign extension. These are handled by skipping a word in the input,
46 * zeroing a word of output, and copying a word from input to output.
48 * s = a 32-bit value such as a long, which must be sign-extended to a 64-bit
49 * long-long in the uu_args. These are handled by skipping a word of
50 * input, loading a word of input and sign extending it to a double,
51 * and storing two words of output.
53 * l = a 64-bit long-long, passed in two registers. These are handled by skipping
54 * a word of input, copying a word, skipping another word of input, and
55 * copying another word.
57 * d = a 32-bit int or a 64-bit ptr or long, passed in via a 64-bit GPR
58 * from a 64-bit process. We copy two words from input to output.
60 * For example, "munge_wls" takes a word, a long-long, and a word. This takes
61 * four registers: the first word is in one, the long-long takes two, and the
62 * final word is in the fourth. We store six words: a 0, the low words of the
63 * first three registers, and the two words resulting from sign-extending the
64 * low word of the fourth register.
66 * As you can see, we save a lot of code by collapsing mungers that are prefixes
67 * of each other, into the more general routine. This ends up copying a few extra
68 * bytes of parameters, but big deal. The old kernel copied all eight words for
71 * These routines assume explicit pad words in the uu_arg structures, that fill out
72 * int parameters to 64 bits. Having pad words makes munging args for 64-bit
73 * processes the equivalent of a simple bcopy(), though it does introduce an
78 .globl _munge_dddddddd // that is 8 'd's
130 .globl _munge_wwwwwwww // that is 8 'w's
132 .globl _munge_wwwwwww
277 .globl _munge_wwwwl // 4 'w's and an l
302 .globl _munge_wwwwwl // 5 'w's and an l