Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1 | /* |
| 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 Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 5 | * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> |
Roland McGrath | e1e584b | 2003-06-02 19:18:58 +0000 | [diff] [blame] | 6 | * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH |
| 7 | * port by Greg Banks <gbanks@pocketpenguins.com> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 8 | * 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 Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #include "defs.h" |
Roland McGrath | 05cdd3c | 2004-03-02 06:16:59 +0000 | [diff] [blame] | 34 | #include <asm/mman.h> |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 35 | #include <sys/mman.h> |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 36 | |
Dmitry V. Levin | ea1fea6 | 2015-03-31 19:45:08 +0000 | [diff] [blame] | 37 | unsigned long |
| 38 | get_pagesize(void) |
Dmitry V. Levin | c76a363 | 2013-03-05 14:58:24 +0000 | [diff] [blame] | 39 | { |
| 40 | static unsigned long pagesize; |
| 41 | |
| 42 | if (!pagesize) |
| 43 | pagesize = sysconf(_SC_PAGESIZE); |
| 44 | return pagesize; |
| 45 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 46 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 47 | SYS_FUNC(brk) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 48 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 49 | printaddr(tcp->u_arg[0]); |
| 50 | |
| 51 | return RVAL_DECODED | RVAL_HEX; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 54 | #include "xlat/mmap_prot.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 55 | #include "xlat/mmap_flags.h" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 56 | |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 57 | static void |
Denys Vlasenko | 923255c | 2013-02-18 02:36:36 +0100 | [diff] [blame] | 58 | print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 59 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 60 | /* addr */ |
| 61 | printaddr(u_arg[0]); |
| 62 | /* len */ |
| 63 | tprintf(", %lu, ", u_arg[1]); |
| 64 | /* prot */ |
| 65 | printflags(mmap_prot, u_arg[2], "PROT_???"); |
| 66 | tprints(", "); |
| 67 | /* flags */ |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 68 | #ifdef MAP_TYPE |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 69 | printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???"); |
| 70 | addflags(mmap_flags, u_arg[3] & ~MAP_TYPE); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 71 | #else |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 72 | printflags(mmap_flags, u_arg[3], "MAP_???"); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 73 | #endif |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 74 | tprints(", "); |
| 75 | /* fd */ |
| 76 | printfd(tcp, u_arg[4]); |
| 77 | /* offset */ |
| 78 | tprintf(", %#llx", offset); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 79 | } |
| 80 | |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 81 | /* 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 | |
| 89 | /* Params are pointed to by u_arg[0], offset is in bytes */ |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 90 | SYS_FUNC(old_mmap) |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 91 | { |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 92 | long u_arg[6]; |
Denys Vlasenko | 72a5848 | 2011-08-19 16:01:51 +0200 | [diff] [blame] | 93 | #if defined(IA64) |
Denys Vlasenko | adedb51 | 2008-12-30 18:47:55 +0000 | [diff] [blame] | 94 | /* |
Denys Vlasenko | 9aa9796 | 2011-08-19 17:07:38 +0200 | [diff] [blame] | 95 | * IA64 processes never call this routine, they only use the |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 96 | * new 'sys_mmap' interface. Only IA32 processes come here. |
Denys Vlasenko | adedb51 | 2008-12-30 18:47:55 +0000 | [diff] [blame] | 97 | */ |
Denys Vlasenko | 9aa9796 | 2011-08-19 17:07:38 +0200 | [diff] [blame] | 98 | int i; |
Denys Vlasenko | 923255c | 2013-02-18 02:36:36 +0100 | [diff] [blame] | 99 | unsigned narrow_arg[6]; |
Denys Vlasenko | 7e69ed9 | 2015-03-21 19:50:53 +0100 | [diff] [blame] | 100 | if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1) |
Denys Vlasenko | 9aa9796 | 2011-08-19 17:07:38 +0200 | [diff] [blame] | 101 | return 0; |
Denys Vlasenko | adedb51 | 2008-12-30 18:47:55 +0000 | [diff] [blame] | 102 | for (i = 0; i < 6; i++) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 103 | u_arg[i] = (unsigned long) narrow_arg[i]; |
Denys Vlasenko | 923255c | 2013-02-18 02:36:36 +0100 | [diff] [blame] | 104 | #elif defined(X86_64) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 105 | /* We are here only in personality 1 (i386) */ |
| 106 | int i; |
| 107 | unsigned narrow_arg[6]; |
Denys Vlasenko | 7e69ed9 | 2015-03-21 19:50:53 +0100 | [diff] [blame] | 108 | if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 109 | return 0; |
| 110 | for (i = 0; i < 6; ++i) |
| 111 | u_arg[i] = (unsigned long) narrow_arg[i]; |
Denys Vlasenko | 923255c | 2013-02-18 02:36:36 +0100 | [diff] [blame] | 112 | #else |
Denys Vlasenko | 7e69ed9 | 2015-03-21 19:50:53 +0100 | [diff] [blame] | 113 | if (umoven(tcp, tcp->u_arg[0], sizeof(u_arg), u_arg) == -1) |
Denys Vlasenko | adedb51 | 2008-12-30 18:47:55 +0000 | [diff] [blame] | 114 | return 0; |
Denys Vlasenko | 923255c | 2013-02-18 02:36:36 +0100 | [diff] [blame] | 115 | #endif |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 116 | print_mmap(tcp, u_arg, (unsigned long) u_arg[5]); |
| 117 | |
| 118 | return RVAL_DECODED | RVAL_HEX; |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 119 | } |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 120 | |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 121 | #if defined(S390) |
| 122 | /* Params are pointed to by u_arg[0], offset is in pages */ |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 123 | SYS_FUNC(old_mmap_pgoff) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 124 | { |
| 125 | long u_arg[5]; |
| 126 | int i; |
| 127 | unsigned narrow_arg[6]; |
| 128 | unsigned long long offset; |
Denys Vlasenko | 7e69ed9 | 2015-03-21 19:50:53 +0100 | [diff] [blame] | 129 | if (umoven(tcp, tcp->u_arg[0], sizeof(narrow_arg), narrow_arg) == -1) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 130 | return 0; |
| 131 | for (i = 0; i < 5; i++) |
| 132 | u_arg[i] = (unsigned long) narrow_arg[i]; |
| 133 | offset = narrow_arg[5]; |
Dmitry V. Levin | c76a363 | 2013-03-05 14:58:24 +0000 | [diff] [blame] | 134 | offset *= get_pagesize(); |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 135 | print_mmap(tcp, u_arg, offset); |
| 136 | |
| 137 | return RVAL_DECODED | RVAL_HEX; |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 138 | } |
| 139 | #endif |
| 140 | |
| 141 | /* Params are passed directly, offset is in bytes */ |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 142 | SYS_FUNC(mmap) |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 143 | { |
Denys Vlasenko | 8dedb0d | 2013-02-18 03:13:07 +0100 | [diff] [blame] | 144 | unsigned long long offset = (unsigned long) tcp->u_arg[5]; |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 145 | #if defined(LINUX_MIPSN32) || defined(X32) |
Denys Vlasenko | 8dedb0d | 2013-02-18 03:13:07 +0100 | [diff] [blame] | 146 | /* Try test/x32_mmap.c */ |
Denys Vlasenko | adedb51 | 2008-12-30 18:47:55 +0000 | [diff] [blame] | 147 | offset = tcp->ext_arg[5]; |
Roland McGrath | 542c2c6 | 2008-05-20 01:11:56 +0000 | [diff] [blame] | 148 | #endif |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 149 | /* Example of kernel-side handling of this variety of mmap: |
| 150 | * arch/x86/kernel/sys_x86_64.c::SYSCALL_DEFINE6(mmap, ...) calls |
| 151 | * sys_mmap_pgoff(..., off >> PAGE_SHIFT); i.e. off is in bytes, |
| 152 | * since the above code converts off to pages. |
| 153 | */ |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 154 | print_mmap(tcp, tcp->u_arg, offset); |
| 155 | |
| 156 | return RVAL_DECODED | RVAL_HEX; |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | /* Params are passed directly, offset is in pages */ |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 160 | SYS_FUNC(mmap_pgoff) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 161 | { |
| 162 | /* Try test/mmap_offset_decode.c */ |
| 163 | unsigned long long offset; |
| 164 | offset = (unsigned long) tcp->u_arg[5]; |
Dmitry V. Levin | c76a363 | 2013-03-05 14:58:24 +0000 | [diff] [blame] | 165 | offset *= get_pagesize(); |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 166 | print_mmap(tcp, tcp->u_arg, offset); |
| 167 | |
| 168 | return RVAL_DECODED | RVAL_HEX; |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 169 | } |
| 170 | |
| 171 | /* Params are passed directly, offset is in 4k units */ |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 172 | SYS_FUNC(mmap_4koff) |
Denys Vlasenko | 1ba8543 | 2013-02-19 11:28:20 +0100 | [diff] [blame] | 173 | { |
| 174 | unsigned long long offset; |
| 175 | offset = (unsigned long) tcp->u_arg[5]; |
| 176 | offset <<= 12; |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 177 | print_mmap(tcp, tcp->u_arg, offset); |
| 178 | |
| 179 | return RVAL_DECODED | RVAL_HEX; |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 180 | } |
| 181 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 182 | SYS_FUNC(munmap) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 183 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 184 | printaddr(tcp->u_arg[0]); |
| 185 | tprintf(", %lu", tcp->u_arg[1]); |
| 186 | |
| 187 | return RVAL_DECODED; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 188 | } |
| 189 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 190 | SYS_FUNC(mprotect) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 191 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 192 | printaddr(tcp->u_arg[0]); |
| 193 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 194 | printflags(mmap_prot, tcp->u_arg[2], "PROT_???"); |
| 195 | |
| 196 | return RVAL_DECODED; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 197 | } |
| 198 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 199 | #include "xlat/mremap_flags.h" |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 200 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 201 | SYS_FUNC(mremap) |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 202 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 203 | printaddr(tcp->u_arg[0]); |
| 204 | tprintf(", %lu, %lu, ", tcp->u_arg[1], tcp->u_arg[2]); |
| 205 | printflags(mremap_flags, tcp->u_arg[3], "MREMAP_???"); |
Dmitry V. Levin | fdc4559 | 2009-12-24 23:34:58 +0000 | [diff] [blame] | 206 | #ifdef MREMAP_FIXED |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 207 | if ((tcp->u_arg[3] & (MREMAP_MAYMOVE | MREMAP_FIXED)) == |
| 208 | (MREMAP_MAYMOVE | MREMAP_FIXED)) { |
| 209 | tprints(", "); |
| 210 | printaddr(tcp->u_arg[4]); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 211 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 212 | #endif |
| 213 | return RVAL_DECODED | RVAL_HEX; |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 214 | } |
| 215 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 216 | #include "xlat/madvise_cmds.h" |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 217 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 218 | SYS_FUNC(madvise) |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 219 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 220 | printaddr(tcp->u_arg[0]); |
| 221 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 222 | printxval(madvise_cmds, tcp->u_arg[2], "MADV_???"); |
| 223 | |
| 224 | return RVAL_DECODED; |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 225 | } |
| 226 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 227 | #include "xlat/mlockall_flags.h" |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 228 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 229 | SYS_FUNC(mlockall) |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 230 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 231 | printflags(mlockall_flags, tcp->u_arg[0], "MCL_???"); |
| 232 | |
| 233 | return RVAL_DECODED; |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 234 | } |
| 235 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 236 | #include "xlat/mctl_sync.h" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 237 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 238 | SYS_FUNC(msync) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 239 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 240 | /* addr */ |
| 241 | printaddr(tcp->u_arg[0]); |
| 242 | /* len */ |
| 243 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 244 | /* flags */ |
| 245 | printflags(mctl_sync, tcp->u_arg[2], "MS_???"); |
| 246 | |
| 247 | return RVAL_DECODED; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 248 | } |
| 249 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 250 | SYS_FUNC(mincore) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 251 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 252 | if (entering(tcp)) { |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 253 | printaddr(tcp->u_arg[0]); |
| 254 | tprintf(", %lu, ", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 255 | } else { |
Denys Vlasenko | 1d46ba5 | 2011-08-31 14:00:02 +0200 | [diff] [blame] | 256 | unsigned long i, len; |
| 257 | char *vec = NULL; |
| 258 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 259 | len = tcp->u_arg[1]; |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 260 | if (syserror(tcp) || !verbose(tcp) || |
| 261 | !tcp->u_arg[2] || !(vec = malloc(len)) || |
| 262 | umoven(tcp, tcp->u_arg[2], len, vec) < 0) |
| 263 | printaddr(tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 264 | else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 265 | tprints("["); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 266 | for (i = 0; i < len; i++) { |
| 267 | if (abbrev(tcp) && i >= max_strlen) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 268 | tprints("..."); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 269 | break; |
| 270 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 271 | tprints((vec[i] & 1) ? "1" : "0"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 272 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 273 | tprints("]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 274 | } |
Denys Vlasenko | 1d46ba5 | 2011-08-31 14:00:02 +0200 | [diff] [blame] | 275 | free(vec); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 276 | } |
| 277 | return 0; |
| 278 | } |
| 279 | |
Dmitry V. Levin | ece9ce6 | 2015-07-21 15:55:09 +0000 | [diff] [blame] | 280 | #if defined ALPHA || defined IA64 || defined M68K \ |
| 281 | || defined SPARC || defined SPARC64 |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 282 | SYS_FUNC(getpagesize) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 283 | { |
| 284 | if (exiting(tcp)) |
| 285 | return RVAL_HEX; |
| 286 | return 0; |
| 287 | } |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 288 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 289 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 290 | SYS_FUNC(remap_file_pages) |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 291 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 292 | printaddr(tcp->u_arg[0]); |
| 293 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 294 | printflags(mmap_prot, tcp->u_arg[2], "PROT_???"); |
| 295 | tprintf(", %lu, ", tcp->u_arg[3]); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 296 | #ifdef MAP_TYPE |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 297 | printxval(mmap_flags, tcp->u_arg[4] & MAP_TYPE, "MAP_???"); |
| 298 | addflags(mmap_flags, tcp->u_arg[4] & ~MAP_TYPE); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 299 | #else |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 300 | printflags(mmap_flags, tcp->u_arg[4], "MAP_???"); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 301 | #endif |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 302 | |
| 303 | return RVAL_DECODED; |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 304 | } |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 305 | |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 306 | #define MPOL_DEFAULT 0 |
| 307 | #define MPOL_PREFERRED 1 |
| 308 | #define MPOL_BIND 2 |
| 309 | #define MPOL_INTERLEAVE 3 |
| 310 | |
| 311 | #define MPOL_F_NODE (1<<0) |
| 312 | #define MPOL_F_ADDR (1<<1) |
| 313 | |
| 314 | #define MPOL_MF_STRICT (1<<0) |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 315 | #define MPOL_MF_MOVE (1<<1) |
| 316 | #define MPOL_MF_MOVE_ALL (1<<2) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 317 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 318 | #include "xlat/policies.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 319 | #include "xlat/mbindflags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 320 | #include "xlat/mempolicyflags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 321 | #include "xlat/move_pages_flags.h" |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 322 | |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 323 | static void |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 324 | get_nodes(struct tcb *tcp, unsigned long ptr, unsigned long maxnodes, int err) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 325 | { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 326 | unsigned long nlongs, size, end; |
| 327 | |
| 328 | nlongs = (maxnodes + 8 * sizeof(long) - 1) / (8 * sizeof(long)); |
| 329 | size = nlongs * sizeof(long); |
| 330 | end = ptr + size; |
| 331 | if (nlongs == 0 || ((err || verbose(tcp)) && (size * 8 == maxnodes) |
| 332 | && (end > ptr))) { |
| 333 | unsigned long n, cur, abbrev_end; |
| 334 | int failed = 0; |
| 335 | |
| 336 | if (abbrev(tcp)) { |
| 337 | abbrev_end = ptr + max_strlen * sizeof(long); |
| 338 | if (abbrev_end < ptr) |
| 339 | abbrev_end = end; |
| 340 | } else { |
| 341 | abbrev_end = end; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 342 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 343 | tprints(", {"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 344 | for (cur = ptr; cur < end; cur += sizeof(long)) { |
| 345 | if (cur > ptr) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 346 | tprints(", "); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 347 | if (cur >= abbrev_end) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 348 | tprints("..."); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 349 | break; |
| 350 | } |
Denys Vlasenko | 7e69ed9 | 2015-03-21 19:50:53 +0100 | [diff] [blame] | 351 | if (umoven(tcp, cur, sizeof(n), &n) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 352 | tprints("?"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 353 | failed = 1; |
| 354 | break; |
| 355 | } |
| 356 | tprintf("%#0*lx", (int) sizeof(long) * 2 + 2, n); |
| 357 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 358 | tprints("}"); |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 359 | if (failed) { |
| 360 | tprints(" "); |
| 361 | printaddr(ptr); |
| 362 | } |
| 363 | } else { |
| 364 | tprints(" "); |
| 365 | printaddr(ptr); |
| 366 | } |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 367 | tprintf(", %lu", maxnodes); |
| 368 | } |
| 369 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 370 | SYS_FUNC(mbind) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 371 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 372 | printaddr(tcp->u_arg[0]); |
| 373 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 374 | printxval(policies, tcp->u_arg[2], "MPOL_???"); |
| 375 | get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[4], 0); |
| 376 | tprints(", "); |
| 377 | printflags(mbindflags, tcp->u_arg[5], "MPOL_???"); |
| 378 | |
| 379 | return RVAL_DECODED; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 380 | } |
| 381 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 382 | SYS_FUNC(set_mempolicy) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 383 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 384 | printxval(policies, tcp->u_arg[0], "MPOL_???"); |
| 385 | get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], 0); |
| 386 | |
| 387 | return RVAL_DECODED; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 388 | } |
| 389 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 390 | SYS_FUNC(get_mempolicy) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 391 | { |
| 392 | if (exiting(tcp)) { |
| 393 | int pol; |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 394 | if (!umove_or_printaddr(tcp, tcp->u_arg[0], &pol)) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 395 | printxval(policies, pol, "MPOL_???"); |
| 396 | get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], syserror(tcp)); |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 397 | tprints(", "); |
| 398 | printaddr(tcp->u_arg[3]); |
| 399 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 400 | printflags(mempolicyflags, tcp->u_arg[4], "MPOL_???"); |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 401 | } |
| 402 | return 0; |
| 403 | } |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 404 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 405 | SYS_FUNC(migrate_pages) |
Dmitry V. Levin | 64d0e71 | 2012-03-11 22:44:14 +0000 | [diff] [blame] | 406 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 407 | tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); |
| 408 | get_nodes(tcp, tcp->u_arg[2], tcp->u_arg[1], 0); |
| 409 | tprints(", "); |
| 410 | get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[1], 0); |
| 411 | |
| 412 | return RVAL_DECODED; |
Dmitry V. Levin | 64d0e71 | 2012-03-11 22:44:14 +0000 | [diff] [blame] | 413 | } |
| 414 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 415 | SYS_FUNC(move_pages) |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 416 | { |
| 417 | if (entering(tcp)) { |
| 418 | unsigned long npages = tcp->u_arg[1]; |
| 419 | tprintf("%ld, %lu, ", tcp->u_arg[0], npages); |
| 420 | if (tcp->u_arg[2] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 421 | tprints("NULL, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 422 | else { |
Dmitry V. Levin | 3ed5d02 | 2014-09-10 13:46:04 +0000 | [diff] [blame] | 423 | unsigned int i; |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 424 | long puser = tcp->u_arg[2]; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 425 | tprints("{"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 426 | for (i = 0; i < npages; ++i) { |
| 427 | void *p; |
| 428 | if (i > 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 429 | tprints(", "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 430 | if (umove(tcp, puser, &p) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 431 | tprints("???"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 432 | break; |
| 433 | } |
| 434 | tprintf("%p", p); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 435 | puser += sizeof(void *); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 436 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 437 | tprints("}, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 438 | } |
| 439 | if (tcp->u_arg[3] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 440 | tprints("NULL, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 441 | else { |
Dmitry V. Levin | 3ed5d02 | 2014-09-10 13:46:04 +0000 | [diff] [blame] | 442 | unsigned int i; |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 443 | long nodeuser = tcp->u_arg[3]; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 444 | tprints("{"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 445 | for (i = 0; i < npages; ++i) { |
| 446 | int node; |
| 447 | if (i > 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 448 | tprints(", "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 449 | if (umove(tcp, nodeuser, &node) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 450 | tprints("???"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 451 | break; |
| 452 | } |
| 453 | tprintf("%#x", node); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 454 | nodeuser += sizeof(int); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 455 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 456 | tprints("}, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 457 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 458 | } else { |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 459 | unsigned long npages = tcp->u_arg[1]; |
| 460 | if (tcp->u_arg[4] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 461 | tprints("NULL, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 462 | else { |
Dmitry V. Levin | 3ed5d02 | 2014-09-10 13:46:04 +0000 | [diff] [blame] | 463 | unsigned int i; |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 464 | long statususer = tcp->u_arg[4]; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 465 | tprints("{"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 466 | for (i = 0; i < npages; ++i) { |
| 467 | int status; |
| 468 | if (i > 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 469 | tprints(", "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 470 | if (umove(tcp, statususer, &status) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 471 | tprints("???"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 472 | break; |
| 473 | } |
| 474 | tprintf("%#x", status); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 475 | statususer += sizeof(int); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 476 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 477 | tprints("}, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 478 | } |
| 479 | printflags(move_pages_flags, tcp->u_arg[5], "MPOL_???"); |
| 480 | } |
| 481 | return 0; |
| 482 | } |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 483 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 484 | #if defined(POWERPC) |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 485 | SYS_FUNC(subpage_prot) |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 486 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 487 | unsigned long cur, end, abbrev_end, entries; |
| 488 | unsigned int entry; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 489 | |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 490 | printaddr(tcp->u_arg[0]); |
| 491 | tprints(", "); |
| 492 | printaddr(tcp->u_arg[1]); |
| 493 | tprints(", "); |
| 494 | entries = tcp->u_arg[1] >> 16; |
| 495 | if (!entries || !tcp->u_arg[2]) { |
| 496 | tprints("{}"); |
| 497 | return 0; |
| 498 | } |
| 499 | cur = tcp->u_arg[2]; |
| 500 | end = cur + (sizeof(int) * entries); |
| 501 | if (!verbose(tcp) || end < (unsigned long) tcp->u_arg[2]) { |
| 502 | printaddr(tcp->u_arg[2]); |
| 503 | return 0; |
| 504 | } |
| 505 | if (abbrev(tcp)) { |
| 506 | abbrev_end = cur + (sizeof(int) * max_strlen); |
| 507 | if (abbrev_end > end) |
| 508 | abbrev_end = end; |
| 509 | } |
| 510 | else |
| 511 | abbrev_end = end; |
| 512 | tprints("{"); |
| 513 | for (; cur < end; cur += sizeof(int)) { |
| 514 | if (cur > (unsigned long) tcp->u_arg[2]) |
| 515 | tprints(", "); |
| 516 | if (cur >= abbrev_end) { |
| 517 | tprints("..."); |
| 518 | break; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 519 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 520 | if (umove(tcp, cur, &entry) < 0) { |
| 521 | tprintf("??? [%#lx]", cur); |
| 522 | break; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 523 | } |
| 524 | else |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 525 | tprintf("%#08x", entry); |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 526 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 527 | tprints("}"); |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 528 | |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 529 | return RVAL_DECODED; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 530 | } |
| 531 | #endif |