2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
32 * Syscall argument mungers.
34 * Passed a pointer to the users register array in the savearea, we copy args into
35 * the uu_arg[] array, padding etc as appropriate. The issue is that parameters
36 * passed in registers from a 32-bit address space do not map directly into the uu_args.
37 * For example, a 32-bit long-long comes in two registers, but we need to combine
38 * them into one 64-bit long-long in the uu_args.
40 * There are several functions in this file. Each takes two parameters:
42 * void munge_XXXX( const void *regs, void *uu_args);
44 * The name of the function encodes the number and type of the parameters, as follows:
46 * w = a 32-bit value such as an int or a 32-bit ptr, that does not require
47 * sign extension. These are handled by skipping a word in the input,
48 * zeroing a word of output, and copying a word from input to output.
50 * s = a 32-bit value such as a long, which must be sign-extended to a 64-bit
51 * long-long in the uu_args. These are handled by skipping a word of
52 * input, loading a word of input and sign extending it to a double,
53 * and storing two words of output.
55 * l = a 64-bit long-long, passed in two registers. These are handled by skipping
56 * a word of input, copying a word, skipping another word of input, and
57 * copying another word.
59 * d = a 32-bit int or a 64-bit ptr or long, passed in via a 64-bit GPR
60 * from a 64-bit process. We copy two words from input to output.
62 * For example, "munge_wls" takes a word, a long-long, and a word. This takes
63 * four registers: the first word is in one, the long-long takes two, and the
64 * final word is in the fourth. We store six words: a 0, the low words of the
65 * first three registers, and the two words resulting from sign-extending the
66 * low word of the fourth register.
68 * As you can see, we save a lot of code by collapsing mungers that are prefixes
69 * of each other, into the more general routine. This ends up copying a few extra
70 * bytes of parameters, but big deal. The old kernel copied all eight words for
73 * These routines assume explicit pad words in the uu_arg structures, that fill out
74 * int parameters to 64 bits. Having pad words makes munging args for 64-bit
75 * processes the equivalent of a simple bcopy(), though it does introduce an
80 .globl _munge_dddddddd // that is 8 'd's
132 .globl _munge_wwwwwwww // that is 8 'w's
134 .globl _munge_wwwwwww
252 .globl _munge_wwwwl // 4 'w's and an l
277 .globl _munge_wwwwwl // 5 'w's and an l