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 * XXX - this was introduced in SunOS 4.x to distinguish between
90 * the old pre-4.x "mmap()", which:
92 * only let you map devices with an "mmap" routine (e.g.,
95 * required you to specify the mapping address;
97 * returned 0 on success and -1 on failure;
99 * memory and which, and the 4.x "mmap()" which:
101 * can map plain files;
103 * can be asked to pick where to map the file;
105 * returns the address where it mapped the file on success
108 * It's not actually used in source code that calls "mmap()"; the
109 * "mmap()" routine adds it for you.
111 * It'd be nice to come up with some way of eliminating it from
112 * the flags, e.g. reporting calls *without* it as "old_mmap()"
113 * and calls with it as "mmap()".
116 { _MAP_NEW, "_MAP_NEW" },
119 { MAP_GROWSDOWN,"MAP_GROWSDOWN" },
122 { MAP_DENYWRITE,"MAP_DENYWRITE" },
124 #ifdef MAP_EXECUTABLE
125 { MAP_EXECUTABLE,"MAP_EXECUTABLE"},
128 { MAP_FILE,"MAP_FILE"},
131 { MAP_LOCKED,"MAP_LOCKED"},
141 # if defined(ALPHA) || defined(sparc) || defined(POWERPC)
142 long *u_arg = tcp->u_arg;
147 long *u_arg = tcp->u_arg;
151 #if defined(LINUX) && !defined(ALPHA) && !defined(sparc) && !defined(POWERPC)
152 if (umoven(tcp, tcp->u_arg[0], sizeof u_arg,
153 (char *) u_arg) == -1)
155 #endif /* LINUX && !ALPHA && !sparc && !POWERPC */
161 tprintf("%#lx, ", u_arg[0]);
163 tprintf("%lu, ", u_arg[1]);
165 printflags(mmap_prot, u_arg[2]);
168 printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
169 addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
171 tprintf(", %ld, ", u_arg[4]);
173 tprintf("%#lx", u_arg[5]);
184 tcp->u_arg[0], tcp->u_arg[1]);
194 tprintf("%#lx, %lu, ",
195 tcp->u_arg[0], tcp->u_arg[1]);
196 if (!printflags(mmap_prot, tcp->u_arg[2]))
204 static struct xlat mremap_flags[] = {
205 { MREMAP_MAYMOVE, "MREMAP_MAYMOVE" },
213 tprintf("%#lx, %lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1],
215 printflags(mremap_flags, tcp->u_arg[3]);
224 static struct xlat mctl_sync[] = {
225 { MS_ASYNC, "MS_ASYNC" },
226 { MS_INVALIDATE,"MS_INVALIDATE" },
228 { MS_SYNC, "MS_SYNC" },
239 tprintf("%#lx", tcp->u_arg[0]);
241 tprintf(", %lu, ", tcp->u_arg[1]);
243 if (!printflags(mctl_sync, tcp->u_arg[2]))
249 #endif /* MS_ASYNC */
253 static struct xlat mctl_funcs[] = {
254 { MC_LOCK, "MC_LOCK" },
255 { MC_LOCKAS, "MC_LOCKAS" },
256 { MC_SYNC, "MC_SYNC" },
257 { MC_UNLOCK, "MC_UNLOCK" },
258 { MC_UNLOCKAS, "MC_UNLOCKAS" },
262 static struct xlat mctl_lockas[] = {
263 { MCL_CURRENT, "MCL_CURRENT" },
264 { MCL_FUTURE, "MCL_FUTURE" },
276 tprintf("%#lx", tcp->u_arg[0]);
278 tprintf(", %lu, ", tcp->u_arg[1]);
280 function = tcp->u_arg[2];
281 if (!printflags(mctl_funcs, function))
288 if (!printflags(mctl_sync, arg))
292 if (!printflags(mctl_lockas, arg))
313 tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
316 if (syserror(tcp) || tcp->u_arg[2] == 0 ||
317 (vec = malloc((u_int)len)) == NULL ||
318 umoven(tcp, tcp->u_arg[2], len, vec) < 0)
319 tprintf("%#lx", tcp->u_arg[2]);
322 for (i = 0; i < len; i++) {
323 if (abbrev(tcp) && i >= max_strlen) {
327 tprintf((vec[i] & 1) ? "1" : "0");
346 #if defined(LINUX) && defined(__i386__)
352 struct modify_ldt_ldt_s copy;
353 tprintf("%ld", tcp->u_arg[0]);
354 if (tcp->u_arg[1] == 0
355 || tcp->u_arg[2] != sizeof (struct modify_ldt_ldt_s)
356 || umove(tcp, tcp->u_arg[1], ©) == -1)
357 tprintf(", %lx", tcp->u_arg[1]);
359 tprintf(", {entry_number:%d, ", copy.entry_number);
363 tprintf("base_addr:%#08lx, "
367 "read_exec_only:%d, "
368 "limit_in_pages:%d, "
369 "seg_not_present:%d, "
377 copy.seg_not_present,
381 tprintf(", %lu", tcp->u_arg[2]);
385 #endif /* LINUX && __i386__ */