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>
39 #if defined(LINUX) && defined(__i386__)
48 tprintf("%#lx", tcp->u_arg[0]);
62 tprintf("%lu", tcp->u_arg[0]);
67 static struct xlat mmap_prot[] = {
68 { PROT_NONE, "PROT_NONE", },
69 { PROT_READ, "PROT_READ" },
70 { PROT_WRITE, "PROT_WRITE" },
71 { PROT_EXEC, "PROT_EXEC" },
75 static struct xlat mmap_flags[] = {
76 { MAP_SHARED, "MAP_SHARED" },
77 { MAP_PRIVATE, "MAP_PRIVATE" },
78 { MAP_FIXED, "MAP_FIXED" },
80 { MAP_ANONYMOUS,"MAP_ANONYMOUS" },
83 { MAP_RENAME, "MAP_RENAME" },
86 { MAP_NORESERVE,"MAP_NORESERVE" },
89 { _MAP_NEW, "_MAP_NEW" },
92 { MAP_GROWSDOWN,"MAP_GROWSDOWN" },
95 { MAP_DENYWRITE,"MAP_DENYWRITE" },
98 { MAP_EXECUTABLE,"MAP_EXECUTABLE"},
101 { MAP_FILE,"MAP_FILE"},
104 { MAP_LOCKED,"MAP_LOCKED"},
114 #if defined(ALPHA) || defined(sparc)
115 long *u_arg = tcp->u_arg;
120 long *u_arg = tcp->u_arg;
125 #if !defined(ALPHA) && !defined(__sparc__)
126 if (umoven(tcp, tcp->u_arg[0], sizeof u_arg,
127 (char *) u_arg) == -1)
129 #endif /* ALPHA/sparc */
133 tprintf("%#lx, ", u_arg[0]);
135 tprintf("%lu, ", u_arg[1]);
137 printflags(mmap_prot, u_arg[2]);
140 printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
141 addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
143 tprintf(", %ld, ", u_arg[4]);
145 tprintf("%#lx", u_arg[5]);
156 tcp->u_arg[0], tcp->u_arg[1]);
166 tprintf("%#lx, %lu, ",
167 tcp->u_arg[0], tcp->u_arg[1]);
168 if (!printflags(mmap_prot, tcp->u_arg[2]))
176 static struct xlat mctl_sync[] = {
177 { MS_ASYNC, "MS_ASYNC" },
178 { MS_INVALIDATE,"MS_INVALIDATE" },
180 { MS_SYNC, "MS_SYNC" },
191 tprintf("%#lx", tcp->u_arg[0]);
193 tprintf(", %lu, ", tcp->u_arg[1]);
195 if (!printflags(mctl_sync, tcp->u_arg[2]))
201 #endif /* MS_ASYNC */
205 static struct xlat mctl_funcs[] = {
206 { MC_LOCK, "MC_LOCK" },
207 { MC_LOCKAS, "MC_LOCKAS" },
208 { MC_SYNC, "MC_SYNC" },
209 { MC_UNLOCK, "MC_UNLOCK" },
210 { MC_UNLOCKAS, "MC_UNLOCKAS" },
214 static struct xlat mctl_lockas[] = {
215 { MCL_CURRENT, "MCL_CURRENT" },
216 { MCL_FUTURE, "MCL_FUTURE" },
228 tprintf("%#lx", tcp->u_arg[0]);
230 tprintf(", %lu, ", tcp->u_arg[1]);
232 function = tcp->u_arg[2];
233 if (!printflags(mctl_funcs, function))
240 if (!printflags(mctl_sync, arg))
244 if (!printflags(mctl_lockas, arg))
265 tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
268 if (syserror(tcp) || tcp->u_arg[2] == 0 ||
269 (vec = malloc((u_int)len)) == NULL ||
270 umoven(tcp, tcp->u_arg[2], len, vec) < 0)
271 tprintf("%#lx", tcp->u_arg[2]);
274 for (i = 0; i < len; i++) {
275 if (abbrev(tcp) && i >= max_strlen) {
279 tprintf((vec[i] & 1) ? "1" : "0");
298 #if defined(LINUX) && defined(__i386__)
304 struct modify_ldt_ldt_s copy;
305 tprintf("%ld", tcp->u_arg[0]);
306 if (tcp->u_arg[1] == 0
307 || tcp->u_arg[2] != sizeof (struct modify_ldt_ldt_s)
308 || umove(tcp, tcp->u_arg[1], ©) == -1)
309 tprintf(", %lx", tcp->u_arg[1]);
311 tprintf(", {entry_number:%d, ", copy.entry_number);
315 tprintf("base_addr:%#08lx, "
319 "read_exec_only:%d, "
320 "limit_in_pages:%d, "
321 "seg_not_present:%d, "
329 copy.seg_not_present,
333 tprintf(", %lu", tcp->u_arg[2]);
337 #endif /* LINUX && __i386__ */