blob: 40ed707af075f9bbb3dbc22df6b259e2612f1229 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
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>
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00005 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
Roland McGrathe1e584b2003-06-02 19:18:58 +00006 * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH
7 * port by Greg Banks <gbanks@pocketpenguins.com>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00008 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000031 */
32
33#include "defs.h"
Roland McGrath05cdd3c2004-03-02 06:16:59 +000034#include <asm/mman.h>
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000035#include <sys/mman.h>
Denys Vlasenko1ba85432013-02-19 11:28:20 +010036
Dmitry V. Levinea1fea62015-03-31 19:45:08 +000037unsigned long
38get_pagesize(void)
Dmitry V. Levinc76a3632013-03-05 14:58:24 +000039{
40 static unsigned long pagesize;
41
42 if (!pagesize)
43 pagesize = sysconf(_SC_PAGESIZE);
44 return pagesize;
45}
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000046
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000047SYS_FUNC(brk)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000048{
Dmitry V. Levin85813ce2015-07-19 23:37:40 +000049 printaddr(tcp->u_arg[0]);
50
51 return RVAL_DECODED | RVAL_HEX;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000052}
53
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000054#include "xlat/mmap_prot.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000055#include "xlat/mmap_flags.h"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000056
Dmitry V. Levin85813ce2015-07-19 23:37:40 +000057static void
Elliott Hughesd35df492017-02-15 15:19:05 -080058print_mmap(struct tcb *tcp, kernel_ulong_t *u_arg, unsigned long long offset)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000059{
Elliott Hughesd35df492017-02-15 15:19:05 -080060 const kernel_ulong_t addr = u_arg[0];
61 const kernel_ulong_t len = u_arg[1];
62 const kernel_ulong_t prot = u_arg[2];
63 const kernel_ulong_t flags = u_arg[3];
Dmitry V. Levin3ae86902016-04-01 15:31:23 +000064 const int fd = u_arg[4];
65
66 printaddr(addr);
Elliott Hughesd35df492017-02-15 15:19:05 -080067 tprintf(", %" PRI_klu ", ", len);
68 printflags64(mmap_prot, prot, "PROT_???");
Dmitry V. Levin85813ce2015-07-19 23:37:40 +000069 tprints(", ");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +000070#ifdef MAP_TYPE
Elliott Hughesd35df492017-02-15 15:19:05 -080071 printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???");
Dmitry V. Levin3ae86902016-04-01 15:31:23 +000072 addflags(mmap_flags, flags & ~MAP_TYPE);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +000073#else
Elliott Hughesd35df492017-02-15 15:19:05 -080074 printflags64(mmap_flags, flags, "MAP_???");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +000075#endif
Dmitry V. Levin85813ce2015-07-19 23:37:40 +000076 tprints(", ");
Dmitry V. Levin3ae86902016-04-01 15:31:23 +000077 printfd(tcp, fd);
Dmitry V. Levin85813ce2015-07-19 23:37:40 +000078 tprintf(", %#llx", offset);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000079}
80
Denys Vlasenko1ba85432013-02-19 11:28:20 +010081/* Syscall name<->function correspondence is messed up on many arches.
82 * For example:
83 * i386 has __NR_mmap == 90, and it is "old mmap", and
84 * also it has __NR_mmap2 == 192, which is a "new mmap with page offsets".
85 * But x86_64 has just one __NR_mmap == 9, a "new mmap with byte offsets".
86 * Confused? Me too!
87 */
88
Dmitry V. Levinbc724ce2016-04-22 23:36:26 +000089#if defined AARCH64 || defined ARM \
90 || defined I386 || defined X86_64 || defined X32 \
91 || defined M68K \
92 || defined S390 || defined S390X
Denys Vlasenko1ba85432013-02-19 11:28:20 +010093/* Params are pointed to by u_arg[0], offset is in bytes */
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000094SYS_FUNC(old_mmap)
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +000095{
Elliott Hughesd35df492017-02-15 15:19:05 -080096 kernel_ulong_t u_arg[6];
97# if ANY_WORDSIZE_LESS_THAN_KERNEL_LONG
Dmitry V. Levincf527782016-04-22 23:47:46 +000098 /* We are here only in a 32-bit personality. */
Dmitry V. Levin3db07f12016-04-22 23:41:36 +000099 unsigned int narrow_arg[6];
100 if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg))
101 return RVAL_DECODED | RVAL_HEX;
102 unsigned int i;
103 for (i = 0; i < 6; i++)
104 u_arg[i] = narrow_arg[i];
Dmitry V. Levinbc724ce2016-04-22 23:36:26 +0000105# else
Dmitry V. Levin3db07f12016-04-22 23:41:36 +0000106 if (umove_or_printaddr(tcp, tcp->u_arg[0], &u_arg))
107 return RVAL_DECODED | RVAL_HEX;
Dmitry V. Levinbc724ce2016-04-22 23:36:26 +0000108# endif
Elliott Hughesd35df492017-02-15 15:19:05 -0800109 print_mmap(tcp, u_arg, u_arg[5]);
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000110
111 return RVAL_DECODED | RVAL_HEX;
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +0000112}
Dmitry V. Levinbc724ce2016-04-22 23:36:26 +0000113#endif /* old_mmap architectures */
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +0000114
Elliott Hughesd35df492017-02-15 15:19:05 -0800115#ifdef S390
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100116/* Params are pointed to by u_arg[0], offset is in pages */
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000117SYS_FUNC(old_mmap_pgoff)
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100118{
Elliott Hughesd35df492017-02-15 15:19:05 -0800119 kernel_ulong_t u_arg[5];
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100120 int i;
Elliott Hughesd35df492017-02-15 15:19:05 -0800121 unsigned int narrow_arg[6];
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100122 unsigned long long offset;
Elliott Hughesd35df492017-02-15 15:19:05 -0800123 if (umove_or_printaddr(tcp, tcp->u_arg[0], &narrow_arg))
124 return RVAL_DECODED | RVAL_HEX;
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100125 for (i = 0; i < 5; i++)
Elliott Hughesd35df492017-02-15 15:19:05 -0800126 u_arg[i] = narrow_arg[i];
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100127 offset = narrow_arg[5];
Dmitry V. Levinc76a3632013-03-05 14:58:24 +0000128 offset *= get_pagesize();
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000129 print_mmap(tcp, u_arg, offset);
130
131 return RVAL_DECODED | RVAL_HEX;
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100132}
Elliott Hughesd35df492017-02-15 15:19:05 -0800133#endif /* S390 */
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100134
135/* Params are passed directly, offset is in bytes */
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000136SYS_FUNC(mmap)
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +0000137{
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100138 /* Example of kernel-side handling of this variety of mmap:
139 * arch/x86/kernel/sys_x86_64.c::SYSCALL_DEFINE6(mmap, ...) calls
140 * sys_mmap_pgoff(..., off >> PAGE_SHIFT); i.e. off is in bytes,
141 * since the above code converts off to pages.
142 */
Elliott Hughesd35df492017-02-15 15:19:05 -0800143 print_mmap(tcp, tcp->u_arg, tcp->u_arg[5]);
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000144
145 return RVAL_DECODED | RVAL_HEX;
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100146}
147
148/* Params are passed directly, offset is in pages */
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000149SYS_FUNC(mmap_pgoff)
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100150{
151 /* Try test/mmap_offset_decode.c */
152 unsigned long long offset;
Elliott Hughesd35df492017-02-15 15:19:05 -0800153 offset = tcp->u_arg[5];
Dmitry V. Levinc76a3632013-03-05 14:58:24 +0000154 offset *= get_pagesize();
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000155 print_mmap(tcp, tcp->u_arg, offset);
156
157 return RVAL_DECODED | RVAL_HEX;
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100158}
159
160/* Params are passed directly, offset is in 4k units */
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000161SYS_FUNC(mmap_4koff)
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100162{
163 unsigned long long offset;
Elliott Hughesd35df492017-02-15 15:19:05 -0800164 offset = tcp->u_arg[5];
Denys Vlasenko1ba85432013-02-19 11:28:20 +0100165 offset <<= 12;
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000166 print_mmap(tcp, tcp->u_arg, offset);
167
168 return RVAL_DECODED | RVAL_HEX;
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +0000169}
170
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000171SYS_FUNC(munmap)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000172{
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000173 printaddr(tcp->u_arg[0]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800174 tprintf(", %" PRI_klu, tcp->u_arg[1]);
175
176 return RVAL_DECODED;
177}
178
179static int
180do_mprotect(struct tcb *tcp, bool has_pkey)
181{
182 printaddr(tcp->u_arg[0]);
183 tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
184 printflags64(mmap_prot, tcp->u_arg[2], "PROT_???");
185
186 if (has_pkey)
187 tprintf(", %d", (int) tcp->u_arg[3]);
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000188
189 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000190}
191
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000192SYS_FUNC(mprotect)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000193{
Elliott Hughesd35df492017-02-15 15:19:05 -0800194 return do_mprotect(tcp, false);
195}
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000196
Elliott Hughesd35df492017-02-15 15:19:05 -0800197SYS_FUNC(pkey_mprotect)
198{
199 return do_mprotect(tcp, true);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000200}
201
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000202#include "xlat/mremap_flags.h"
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000203
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000204SYS_FUNC(mremap)
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000205{
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000206 printaddr(tcp->u_arg[0]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800207 tprintf(", %" PRI_klu ", %" PRI_klu ", ", tcp->u_arg[1], tcp->u_arg[2]);
208 printflags64(mremap_flags, tcp->u_arg[3], "MREMAP_???");
Dmitry V. Levinfdc45592009-12-24 23:34:58 +0000209#ifdef MREMAP_FIXED
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000210 if ((tcp->u_arg[3] & (MREMAP_MAYMOVE | MREMAP_FIXED)) ==
211 (MREMAP_MAYMOVE | MREMAP_FIXED)) {
212 tprints(", ");
213 printaddr(tcp->u_arg[4]);
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000214 }
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000215#endif
216 return RVAL_DECODED | RVAL_HEX;
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000217}
218
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000219#include "xlat/madvise_cmds.h"
Wichert Akkermanc7926982000-04-10 22:22:31 +0000220
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000221SYS_FUNC(madvise)
Wichert Akkermanc7926982000-04-10 22:22:31 +0000222{
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000223 printaddr(tcp->u_arg[0]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800224 tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000225 printxval(madvise_cmds, tcp->u_arg[2], "MADV_???");
226
227 return RVAL_DECODED;
Wichert Akkermanc7926982000-04-10 22:22:31 +0000228}
229
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000230#include "xlat/mlockall_flags.h"
Wichert Akkermanc7926982000-04-10 22:22:31 +0000231
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000232SYS_FUNC(mlockall)
Wichert Akkermanc7926982000-04-10 22:22:31 +0000233{
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000234 printflags(mlockall_flags, tcp->u_arg[0], "MCL_???");
235
236 return RVAL_DECODED;
Wichert Akkermanc7926982000-04-10 22:22:31 +0000237}
238
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000239#include "xlat/mctl_sync.h"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000240
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000241SYS_FUNC(msync)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000242{
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000243 /* addr */
244 printaddr(tcp->u_arg[0]);
245 /* len */
Elliott Hughesd35df492017-02-15 15:19:05 -0800246 tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000247 /* flags */
248 printflags(mctl_sync, tcp->u_arg[2], "MS_???");
249
250 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000251}
252
Dmitry V. Levin0d0a50a2015-11-15 02:35:57 +0000253#include "xlat/mlock_flags.h"
254
255SYS_FUNC(mlock2)
256{
257 printaddr(tcp->u_arg[0]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800258 tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
Dmitry V. Levin0d0a50a2015-11-15 02:35:57 +0000259 printflags(mlock_flags, tcp->u_arg[2], "MLOCK_???");
260
261 return RVAL_DECODED;
262}
263
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000264SYS_FUNC(mincore)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000265{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000266 if (entering(tcp)) {
Dmitry V. Levin2c389f62015-07-19 23:25:56 +0000267 printaddr(tcp->u_arg[0]);
Elliott Hughesd35df492017-02-15 15:19:05 -0800268 tprintf(", %" PRI_klu ", ", tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000269 } else {
Dmitry V. Levindfea1da2016-01-29 01:51:54 +0000270 const unsigned long page_size = get_pagesize();
271 const unsigned long page_mask = page_size - 1;
272 unsigned long len = tcp->u_arg[1];
273 unsigned char *vec = NULL;
Denys Vlasenko1d46ba52011-08-31 14:00:02 +0200274
Dmitry V. Levindfea1da2016-01-29 01:51:54 +0000275 len = len / page_size + (len & page_mask ? 1 : 0);
Dmitry V. Levin2c389f62015-07-19 23:25:56 +0000276 if (syserror(tcp) || !verbose(tcp) ||
277 !tcp->u_arg[2] || !(vec = malloc(len)) ||
278 umoven(tcp, tcp->u_arg[2], len, vec) < 0)
279 printaddr(tcp->u_arg[2]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000280 else {
Dmitry V. Levindfea1da2016-01-29 01:51:54 +0000281 unsigned long i;
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200282 tprints("[");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000283 for (i = 0; i < len; i++) {
Elliott Hughesd35df492017-02-15 15:19:05 -0800284 if (i)
285 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000286 if (abbrev(tcp) && i >= max_strlen) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200287 tprints("...");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000288 break;
289 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200290 tprints((vec[i] & 1) ? "1" : "0");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000291 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200292 tprints("]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000293 }
Denys Vlasenko1d46ba52011-08-31 14:00:02 +0200294 free(vec);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000295 }
296 return 0;
297}
298
Dmitry V. Levinece9ce62015-07-21 15:55:09 +0000299#if defined ALPHA || defined IA64 || defined M68K \
300 || defined SPARC || defined SPARC64
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000301SYS_FUNC(getpagesize)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000302{
Dmitry V. Levinb61b2d82016-01-08 19:20:05 +0000303 return RVAL_DECODED | RVAL_HEX;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000304}
Denys Vlasenko84703742012-02-25 02:38:52 +0100305#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000306
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000307SYS_FUNC(remap_file_pages)
Roland McGrath72c5b7b2003-03-05 04:08:00 +0000308{
Elliott Hughesd35df492017-02-15 15:19:05 -0800309 const kernel_ulong_t addr = tcp->u_arg[0];
310 const kernel_ulong_t size = tcp->u_arg[1];
311 const kernel_ulong_t prot = tcp->u_arg[2];
312 const kernel_ulong_t pgoff = tcp->u_arg[3];
313 const kernel_ulong_t flags = tcp->u_arg[4];
Dmitry V. Levin3ae86902016-04-01 15:31:23 +0000314
315 printaddr(addr);
Elliott Hughesd35df492017-02-15 15:19:05 -0800316 tprintf(", %" PRI_klu ", ", size);
317 printflags64(mmap_prot, prot, "PROT_???");
318 tprintf(", %" PRI_klu ", ", pgoff);
Roland McGrath72c5b7b2003-03-05 04:08:00 +0000319#ifdef MAP_TYPE
Elliott Hughesd35df492017-02-15 15:19:05 -0800320 printxval64(mmap_flags, flags & MAP_TYPE, "MAP_???");
Dmitry V. Levin3ae86902016-04-01 15:31:23 +0000321 addflags(mmap_flags, flags & ~MAP_TYPE);
Roland McGrath72c5b7b2003-03-05 04:08:00 +0000322#else
Elliott Hughesd35df492017-02-15 15:19:05 -0800323 printflags64(mmap_flags, flags, "MAP_???");
Roland McGrath72c5b7b2003-03-05 04:08:00 +0000324#endif
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000325
326 return RVAL_DECODED;
Roland McGrath72c5b7b2003-03-05 04:08:00 +0000327}
Roland McGrathb10a3352004-10-07 18:53:12 +0000328
Denys Vlasenko84703742012-02-25 02:38:52 +0100329#if defined(POWERPC)
Dmitry V. Levin0f04b9d2016-05-07 23:00:52 +0000330static bool
331print_protmap_entry(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
332{
333 tprintf("%#08x", * (unsigned int *) elem_buf);
334
335 return true;
336}
337
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000338SYS_FUNC(subpage_prot)
Roland McGrath4a6f6522008-08-25 03:09:16 +0000339{
Elliott Hughesd35df492017-02-15 15:19:05 -0800340 kernel_ulong_t addr = tcp->u_arg[0];
341 kernel_ulong_t len = tcp->u_arg[1];
342 kernel_ulong_t nmemb = len >> 16;
343 kernel_ulong_t map = tcp->u_arg[2];
Roland McGrath4a6f6522008-08-25 03:09:16 +0000344
Dmitry V. Levin0f04b9d2016-05-07 23:00:52 +0000345 printaddr(addr);
Elliott Hughesd35df492017-02-15 15:19:05 -0800346 tprintf(", %" PRI_klu ", ", len);
Dmitry V. Levin0f04b9d2016-05-07 23:00:52 +0000347
348 unsigned int entry;
349 print_array(tcp, map, nmemb, &entry, sizeof(entry),
350 umoven_or_printaddr, print_protmap_entry, 0);
Roland McGrath4a6f6522008-08-25 03:09:16 +0000351
Dmitry V. Levin85813ce2015-07-19 23:37:40 +0000352 return RVAL_DECODED;
Roland McGrath4a6f6522008-08-25 03:09:16 +0000353}
354#endif