]>
git.saurik.com Git - apple/xnu.git/blob - bsd/sys/munge.h
43c30b05fe41901a4d26046df0c2adcfb5af6274
2 * Coyright (c) 2005-2013 Apple 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@
33 * Syscall argument mungers.
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.
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.
44 * There are several functions in this file with the following prototype
46 * void munge_XXXX(void *uu_args);
48 * The name of the function encodes the number and type of the parameters,
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.
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.
60 * l = a 64-bit long-long. These are handled by copying two words
61 * of input to the output.
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.
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.
74 #if __arm__ && (__BIGGEST_ALIGNMENT__ > 4)
75 int munge_w(const void *regs
, void *args
);
76 int munge_ww(const void *regs
, void *args
);
77 int munge_www(const void *regs
, void *args
);
78 int munge_wwww(const void *regs
, void *args
);
79 int munge_wwwww(const void *regs
, void *args
);
80 int munge_wwwwww(const void *regs
, void *args
);
81 int munge_wwwwwww(const void *regs
, void *args
);
82 int munge_wwwwwwww(const void *regs
, void *args
);
83 int munge_wl(const void *regs
, void *args
);
84 int munge_wwl(const void *regs
, void *args
);
85 int munge_wwlw(const void *regs
, void *args
);
86 int munge_wwlll(const void *regs
, void *args
);
87 int munge_wwllww(const void *regs
, void *args
);
88 int munge_wlw(const void *regs
, void *args
);
89 int munge_wlww(const void *regs
, void *args
);
90 int munge_wlwwwl(const void *regs
, void *args
);
91 int munge_wlwwwll(const void *regs
, void *args
);
92 int munge_wlwwwllw(const void *regs
, void *args
);
93 int munge_wlwwlwlw(const void *regs
, void *args
);
94 int munge_wll(const void *regs
, void *args
);
95 int munge_wllww(const void *regs
, void *args
);
96 int munge_wlll(const void *regs
, void *args
);
97 int munge_wlllww(const void *regs
, void *args
);
98 int munge_wllll(const void *regs
, void *args
);
99 int munge_wllwwll(const void *regs
, void *args
);
100 int munge_wwwlw(const void *regs
, void *args
);
101 int munge_wwwlww(const void *regs
, void *args
);
102 int munge_wwwlwww(const void *regs
, void *args
);
103 int munge_wwwl(const void *regs
, void *args
);
104 int munge_wwwwlw(const void *regs
, void *args
);
105 int munge_wwwwllww(const void *regs
, void *args
);
106 int munge_wwwwl(const void *regs
, void *args
);
107 int munge_wwwwwl(const void *regs
, void *args
);
108 int munge_wwwwwlww(const void *regs
, void *args
);
109 int munge_wwwwwllw(const void *regs
, void *args
);
110 int munge_wwwwwlll(const void *regs
, void *args
);
111 int munge_wwwwwwl(const void *regs
, void *args
);
112 int munge_wwwwwwlw(const void *regs
, void *args
);
113 int munge_wwwwwwll(const void *regs
, void *args
);
114 int munge_wsw(const void *regs
, void *args
);
115 int munge_wws(const void *regs
, void *args
);
116 int munge_wwws(const void *regs
, void *args
);
117 int munge_wwwsw(const void *regs
, void *args
);
118 int munge_llllll(const void *regs
, void *args
);
119 int munge_l(const void *regs
, void *args
);
120 int munge_ll(const void *regs
, void *args
);
121 int munge_lw(const void *regs
, void *args
);
122 int munge_lwww(const void *regs
, void *args
);
123 int munge_lwwwwwww(const void *regs
, void *args
);
124 int munge_wwlww(const void *regs
, void *args
);
125 int munge_wwlwww(const void *regs
, void *args
);
126 int munge_wwlwwwl(const void *regs
, void *args
);
128 void munge_w(void *args
);
129 void munge_ww(void *args
);
130 void munge_www(void *args
);
131 void munge_wwww(void *args
);
132 void munge_wwwww(void *args
);
133 void munge_wwwwww(void *args
);
134 void munge_wwwwwww(void *args
);
135 void munge_wwwwwwww(void *args
);
136 void munge_wl(void *args
);
137 void munge_wwl(void *args
);
138 void munge_wwlw(void *args
);
139 void munge_wwlll(void *args
);
140 void munge_wwllww(void *args
);
141 void munge_wlw(void *args
);
142 void munge_wlww(void *args
);
143 void munge_wlwwwl(void *args
);
144 void munge_wlwwwll(void *args
);
145 void munge_wlwwwllw(void *args
);
146 void munge_wlwwlwlw(void *args
);
147 void munge_wll(void *args
);
148 void munge_wllww(void *args
);
149 void munge_wlll(void *args
);
150 void munge_wlllww(void *args
);
151 void munge_wllll(void *args
);
152 void munge_wllwwll(void *args
);
153 void munge_wwwlw(void *args
);
154 void munge_wwwlww(void *args
);
155 void munge_wwwlwww(void *args
);
156 void munge_wwwl(void *args
);
157 void munge_wwwwlw(void *args
);
158 void munge_wwwwllww(void *args
);
159 void munge_wwwwl(void *args
);
160 void munge_wwwwwl(void *args
);
161 void munge_wwwwwlww(void *args
);
162 void munge_wwwwwllw(void *args
);
163 void munge_wwwwwlll(void *args
);
164 void munge_wwwwwwl(void *args
);
165 void munge_wwwwwwlw(void *args
);
166 void munge_wwwwwwll(void *args
);
167 void munge_wsw(void *args
);
168 void munge_wws(void *args
);
169 void munge_wwws(void *args
);
170 void munge_wwwsw(void *args
);
171 void munge_llllll(void *args
);
172 void munge_l(void *args
);
173 void munge_ll(void *args
);
174 void munge_lw(void *args
);
175 void munge_lwww(void *args
);
176 void munge_lwwwwwww(void *args
);
177 void munge_wwlww(void *args
);
178 void munge_wwlwww(void *args
);
179 void munge_wwlwwwl(void *args
);
180 #endif /* __arm__ && (__BIGGEST_ALIGNMENT__ > 4) */
181 #endif /* __MUNGE_H__ */