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_INHERIT,"MAP_INHERIT" },
131 { MAP_FILE,"MAP_FILE"},
134 { MAP_LOCKED,"MAP_LOCKED"},
144 # if defined(ALPHA) || defined(sparc) || defined(POWERPC) || defined(MIPS)
145 long *u_arg = tcp->u_arg;
150 long *u_arg = tcp->u_arg;
154 #if defined(LINUX) && !defined(ALPHA) && !defined(sparc) && !defined(POWERPC) && !defined(MIPS)
155 if (umoven(tcp, tcp->u_arg[0], sizeof u_arg,
156 (char *) u_arg) == -1)
158 #endif /* LINUX && !ALPHA && !sparc && !POWERPC */
164 tprintf("%#lx, ", u_arg[0]);
166 tprintf("%lu, ", u_arg[1]);
168 printflags(mmap_prot, u_arg[2]);
171 printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
172 addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
174 tprintf(", %ld, ", u_arg[4]);
176 tprintf("%#lx", u_arg[5]);
187 tcp->u_arg[0], tcp->u_arg[1]);
197 tprintf("%#lx, %lu, ",
198 tcp->u_arg[0], tcp->u_arg[1]);
199 if (!printflags(mmap_prot, tcp->u_arg[2]))
207 static struct xlat mremap_flags[] = {
208 { MREMAP_MAYMOVE, "MREMAP_MAYMOVE" },
216 tprintf("%#lx, %lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1],
218 printflags(mremap_flags, tcp->u_arg[3]);
227 static struct xlat mctl_sync[] = {
228 { MS_ASYNC, "MS_ASYNC" },
229 { MS_INVALIDATE,"MS_INVALIDATE" },
231 { MS_SYNC, "MS_SYNC" },
242 tprintf("%#lx", tcp->u_arg[0]);
244 tprintf(", %lu, ", tcp->u_arg[1]);
246 if (!printflags(mctl_sync, tcp->u_arg[2]))
252 #endif /* MS_ASYNC */
256 static struct xlat mctl_funcs[] = {
257 { MC_LOCK, "MC_LOCK" },
258 { MC_LOCKAS, "MC_LOCKAS" },
259 { MC_SYNC, "MC_SYNC" },
260 { MC_UNLOCK, "MC_UNLOCK" },
261 { MC_UNLOCKAS, "MC_UNLOCKAS" },
265 static struct xlat mctl_lockas[] = {
266 { MCL_CURRENT, "MCL_CURRENT" },
267 { MCL_FUTURE, "MCL_FUTURE" },
279 tprintf("%#lx", tcp->u_arg[0]);
281 tprintf(", %lu, ", tcp->u_arg[1]);
283 function = tcp->u_arg[2];
284 if (!printflags(mctl_funcs, function))
291 if (!printflags(mctl_sync, arg))
295 if (!printflags(mctl_lockas, arg))
316 tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
319 if (syserror(tcp) || tcp->u_arg[2] == 0 ||
320 (vec = malloc((u_int)len)) == NULL ||
321 umoven(tcp, tcp->u_arg[2], len, vec) < 0)
322 tprintf("%#lx", tcp->u_arg[2]);
325 for (i = 0; i < len; i++) {
326 if (abbrev(tcp) && i >= max_strlen) {
330 tprintf((vec[i] & 1) ? "1" : "0");
349 #if defined(LINUX) && defined(__i386__)
355 struct modify_ldt_ldt_s copy;
356 tprintf("%ld", tcp->u_arg[0]);
357 if (tcp->u_arg[1] == 0
358 || tcp->u_arg[2] != sizeof (struct modify_ldt_ldt_s)
359 || umove(tcp, tcp->u_arg[1], ©) == -1)
360 tprintf(", %lx", tcp->u_arg[1]);
362 tprintf(", {entry_number:%d, ", copy.entry_number);
366 tprintf("base_addr:%#08lx, "
370 "read_exec_only:%d, "
371 "limit_in_pages:%d, "
372 "seg_not_present:%d, "
380 copy.seg_not_present,
384 tprintf(", %lu", tcp->u_arg[2]);
388 #endif /* LINUX && __i386__ */