2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #include <linux/mman.h>
40 #if defined(LINUX) && defined(__i386__)
41 #include <linux/ldt.h>
49 tprintf("%#lx", tcp->u_arg[0]);
63 tprintf("%lu", tcp->u_arg[0]);
68 static struct xlat mmap_prot[] = {
69 { PROT_NONE, "PROT_NONE", },
70 { PROT_READ, "PROT_READ" },
71 { PROT_WRITE, "PROT_WRITE" },
72 { PROT_EXEC, "PROT_EXEC" },
76 static struct xlat mmap_flags[] = {
77 { MAP_SHARED, "MAP_SHARED" },
78 { MAP_PRIVATE, "MAP_PRIVATE" },
79 { MAP_FIXED, "MAP_FIXED" },
81 { MAP_ANONYMOUS,"MAP_ANONYMOUS" },
84 { MAP_RENAME, "MAP_RENAME" },
87 { MAP_NORESERVE,"MAP_NORESERVE" },
90 { _MAP_NEW, "_MAP_NEW" },
93 { MAP_GROWSDOWN,"MAP_GROWSDOWN" },
96 { MAP_DENYWRITE,"MAP_DENYWRITE" },
99 { MAP_EXECUTABLE,"MAP_EXECUTABLE"},
102 { MAP_FILE,"MAP_FILE"},
105 { MAP_LOCKED,"MAP_LOCKED"},
115 # if defined(ALPHA) || defined(sparc)
116 long *u_arg = tcp->u_arg;
121 long *u_arg = tcp->u_arg;
125 #if defined(LINUX) && !defined(ALPHA) && !defined(__sparc__)
126 if (umoven(tcp, tcp->u_arg[0], sizeof u_arg,
127 (char *) u_arg) == -1)
129 #endif /* LINUX && !ALPHA && !sparc */
132 tprintf("%#lx, ", u_arg[0]);
134 tprintf("%lu, ", u_arg[1]);
136 printflags(mmap_prot, u_arg[2]);
139 printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
140 addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
142 tprintf(", %ld, ", u_arg[4]);
144 tprintf("%#lx", u_arg[5]);
155 tcp->u_arg[0], tcp->u_arg[1]);
165 tprintf("%#lx, %lu, ",
166 tcp->u_arg[0], tcp->u_arg[1]);
167 if (!printflags(mmap_prot, tcp->u_arg[2]))
175 static struct xlat mctl_sync[] = {
176 { MS_ASYNC, "MS_ASYNC" },
177 { MS_INVALIDATE,"MS_INVALIDATE" },
179 { MS_SYNC, "MS_SYNC" },
190 tprintf("%#lx", tcp->u_arg[0]);
192 tprintf(", %lu, ", tcp->u_arg[1]);
194 if (!printflags(mctl_sync, tcp->u_arg[2]))
200 #endif /* MS_ASYNC */
204 static struct xlat mctl_funcs[] = {
205 { MC_LOCK, "MC_LOCK" },
206 { MC_LOCKAS, "MC_LOCKAS" },
207 { MC_SYNC, "MC_SYNC" },
208 { MC_UNLOCK, "MC_UNLOCK" },
209 { MC_UNLOCKAS, "MC_UNLOCKAS" },
213 static struct xlat mctl_lockas[] = {
214 { MCL_CURRENT, "MCL_CURRENT" },
215 { MCL_FUTURE, "MCL_FUTURE" },
227 tprintf("%#lx", tcp->u_arg[0]);
229 tprintf(", %lu, ", tcp->u_arg[1]);
231 function = tcp->u_arg[2];
232 if (!printflags(mctl_funcs, function))
239 if (!printflags(mctl_sync, arg))
243 if (!printflags(mctl_lockas, arg))
264 tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
267 if (syserror(tcp) || tcp->u_arg[2] == 0 ||
268 (vec = malloc((u_int)len)) == NULL ||
269 umoven(tcp, tcp->u_arg[2], len, vec) < 0)
270 tprintf("%#lx", tcp->u_arg[2]);
273 for (i = 0; i < len; i++) {
274 if (abbrev(tcp) && i >= max_strlen) {
278 tprintf((vec[i] & 1) ? "1" : "0");
297 #if defined(LINUX) && defined(__i386__)
303 struct modify_ldt_ldt_s copy;
304 tprintf("%ld", tcp->u_arg[0]);
305 if (tcp->u_arg[1] == 0
306 || tcp->u_arg[2] != sizeof (struct modify_ldt_ldt_s)
307 || umove(tcp, tcp->u_arg[1], ©) == -1)
308 tprintf(", %lx", tcp->u_arg[1]);
310 tprintf(", {entry_number:%d, ", copy.entry_number);
314 tprintf("base_addr:%#08lx, "
318 "read_exec_only:%d, "
319 "limit_in_pages:%d, "
320 "seg_not_present:%d, "
328 copy.seg_not_present,
332 tprintf(", %lu", tcp->u_arg[2]);
336 #endif /* LINUX && __i386__ */