]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/munge.h
xnu-2782.10.72.tar.gz
[apple/xnu.git] / bsd / sys / munge.h
1 /*
2 * Coyright (c) 2005-2013 Apple 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 #ifndef __MUNGE_H__
30 #define __MUNGE_H__
31
32 /*
33 * Syscall argument mungers.
34 *
35 * The data to be munged has been explicitly copied in to the argument
36 * area, and will be munged in place in the uu_arg[] array. These
37 * mungers are for 32-bit app's syscalls, since 64-bit args are copied
38 * from the save area to the uu_args in the order the
39 * syscall ABI calls for.
40 *
41 * The issue is that the incoming args are 32-bit, but we must expand
42 * them in place into 64-bit args, as if they were from a 64-bit process.
43 *
44 * There are several functions in this file with the following prototype
45 *
46 * void munge_XXXX(void *uu_args);
47 *
48 * The name of the function encodes the number and type of the parameters,
49 * as follows:
50 *
51 * w = a 32-bit value such as an int or a 32-bit ptr, that does not
52 * require sign extension. These are handled by zeroing a word
53 * of output, and copying a word from input to output.
54 *
55 * s = a 32-bit value such as a long, which must be sign-extended to
56 * a 64-bit long-long in the uu_args. These are handled by
57 * loading a word of input and sign extending it to a double,
58 * and storing two words of output.
59 *
60 * l = a 64-bit long-long. These are handled by copying two words
61 * of input to the output.
62 *
63 * For example, "munge_wls" takes a word, a long-long, and a word. This
64 * takes four words in the uu_arg[] area: the first word is in one, the
65 * long-long takes two, and the final word is in the fourth. We store six
66 * words: the low word is left in place, followed by a 0, followed by the
67 * two words of the long-long, followed by the low word and the sign extended
68 * high word of the preceeding low word.
69 *
70 * Because this is an in-place modification, we actually start at the end
71 * of uu_arg[] and work our way back to the beginning of the array.
72 */
73
74 void munge_w(void *args);
75 void munge_ww(void *args);
76 void munge_www(void *args);
77 void munge_wwww(void *args);
78 void munge_wwwww(void *args);
79 void munge_wwwwww(void *args);
80 void munge_wwwwwww(void *args);
81 void munge_wwwwwwww(void *args);
82 void munge_wl(void *args);
83 void munge_wwl(void *args);
84 void munge_wwlw(void *args);
85 void munge_wwlll(void *args);
86 void munge_wwllww(void *args);
87 void munge_wlw(void *args);
88 void munge_wlwwwll(void *args);
89 void munge_wlwwwllw(void *args);
90 void munge_wlwwlwlw(void *args);
91 void munge_wll(void *args);
92 void munge_wllww(void *args);
93 void munge_wlll(void *args);
94 void munge_wllll(void *args);
95 void munge_wllwwll(void *args);
96 void munge_wwwlw(void *args);
97 void munge_wwwlww(void *args);
98 void munge_wwwl(void *args);
99 void munge_wwwwlw(void *args);
100 void munge_wwwwl(void *args);
101 void munge_wwwwwl(void *args);
102 void munge_wwwwwlww(void *args);
103 void munge_wwwwwllw(void *args);
104 void munge_wwwwwlll(void *args);
105 void munge_wwwwwwl(void *args);
106 void munge_wwwwwwlw(void *args);
107 void munge_wwwwwwll(void *args);
108 void munge_wsw(void *args);
109 void munge_wws(void *args);
110 void munge_wwwsw(void *args);
111 void munge_llllll(void *args);
112 void munge_l(void *args);
113 void munge_ll(void *args);
114 void munge_lw(void *args);
115 void munge_lwww(void *args);
116 void munge_wwlwww(void *args);
117
118 #endif /* __MUNGE_H__ */