]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/munge.h
xnu-3247.1.106.tar.gz
[apple/xnu.git] / bsd / sys / munge.h
CommitLineData
316670eb 1/*
fe8ab488 2 * Coyright (c) 2005-2013 Apple Inc. All rights reserved.
316670eb
A
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 */
fe8ab488
A
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
74void munge_w(void *args);
75void munge_ww(void *args);
76void munge_www(void *args);
77void munge_wwww(void *args);
78void munge_wwwww(void *args);
79void munge_wwwwww(void *args);
80void munge_wwwwwww(void *args);
81void munge_wwwwwwww(void *args);
82void munge_wl(void *args);
83void munge_wwl(void *args);
84void munge_wwlw(void *args);
85void munge_wwlll(void *args);
86void munge_wwllww(void *args);
87void munge_wlw(void *args);
3e170ce0 88void munge_wlww(void *args);
fe8ab488
A
89void munge_wlwwwll(void *args);
90void munge_wlwwwllw(void *args);
91void munge_wlwwlwlw(void *args);
92void munge_wll(void *args);
93void munge_wllww(void *args);
94void munge_wlll(void *args);
a1c7dba1 95void munge_wllll(void *args);
fe8ab488
A
96void munge_wllwwll(void *args);
97void munge_wwwlw(void *args);
98void munge_wwwlww(void *args);
99void munge_wwwl(void *args);
100void munge_wwwwlw(void *args);
101void munge_wwwwl(void *args);
102void munge_wwwwwl(void *args);
103void munge_wwwwwlww(void *args);
104void munge_wwwwwllw(void *args);
105void munge_wwwwwlll(void *args);
106void munge_wwwwwwl(void *args);
107void munge_wwwwwwlw(void *args);
108void munge_wwwwwwll(void *args);
109void munge_wsw(void *args);
110void munge_wws(void *args);
3e170ce0 111void munge_wwws(void *args);
fe8ab488
A
112void munge_wwwsw(void *args);
113void munge_llllll(void *args);
114void munge_l(void *args);
115void munge_ll(void *args);
116void munge_lw(void *args);
117void munge_lwww(void *args);
118void munge_wwlwww(void *args);
316670eb 119#endif /* __MUNGE_H__ */