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 | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 60 | const unsigned long addr = u_arg[0]; |
| 61 | const unsigned long len = u_arg[1]; |
| 62 | const unsigned long prot = u_arg[2]; |
| 63 | const unsigned long flags = u_arg[3]; |
| 64 | const int fd = u_arg[4]; |
| 65 | |
| 66 | printaddr(addr); |
| 67 | tprintf(", %lu, ", len); |
| 68 | printflags(mmap_prot, prot, "PROT_???"); |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 69 | tprints(", "); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 70 | #ifdef MAP_TYPE |
Dmitry V. Levin | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 71 | printxval(mmap_flags, flags & MAP_TYPE, "MAP_???"); |
| 72 | addflags(mmap_flags, flags & ~MAP_TYPE); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 73 | #else |
Dmitry V. Levin | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 74 | printflags(mmap_flags, flags, "MAP_???"); |
Wichert Akkerman | bf79f2e | 2000-09-01 21:03:06 +0000 | [diff] [blame] | 75 | #endif |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 76 | tprints(", "); |
Dmitry V. Levin | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 77 | printfd(tcp, fd); |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 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 | 0d0a50a | 2015-11-15 02:35:57 +0000 | [diff] [blame] | 250 | #include "xlat/mlock_flags.h" |
| 251 | |
| 252 | SYS_FUNC(mlock2) |
| 253 | { |
| 254 | printaddr(tcp->u_arg[0]); |
| 255 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 256 | printflags(mlock_flags, tcp->u_arg[2], "MLOCK_???"); |
| 257 | |
| 258 | return RVAL_DECODED; |
| 259 | } |
| 260 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 261 | SYS_FUNC(mincore) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 262 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 263 | if (entering(tcp)) { |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 264 | printaddr(tcp->u_arg[0]); |
| 265 | tprintf(", %lu, ", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 266 | } else { |
Dmitry V. Levin | dfea1da | 2016-01-29 01:51:54 +0000 | [diff] [blame] | 267 | const unsigned long page_size = get_pagesize(); |
| 268 | const unsigned long page_mask = page_size - 1; |
| 269 | unsigned long len = tcp->u_arg[1]; |
| 270 | unsigned char *vec = NULL; |
Denys Vlasenko | 1d46ba5 | 2011-08-31 14:00:02 +0200 | [diff] [blame] | 271 | |
Dmitry V. Levin | dfea1da | 2016-01-29 01:51:54 +0000 | [diff] [blame] | 272 | len = len / page_size + (len & page_mask ? 1 : 0); |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 273 | if (syserror(tcp) || !verbose(tcp) || |
| 274 | !tcp->u_arg[2] || !(vec = malloc(len)) || |
| 275 | umoven(tcp, tcp->u_arg[2], len, vec) < 0) |
| 276 | printaddr(tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 277 | else { |
Dmitry V. Levin | dfea1da | 2016-01-29 01:51:54 +0000 | [diff] [blame] | 278 | unsigned long i; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 279 | tprints("["); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 280 | for (i = 0; i < len; i++) { |
| 281 | if (abbrev(tcp) && i >= max_strlen) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 282 | tprints("..."); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 283 | break; |
| 284 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 285 | tprints((vec[i] & 1) ? "1" : "0"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 286 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 287 | tprints("]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 288 | } |
Denys Vlasenko | 1d46ba5 | 2011-08-31 14:00:02 +0200 | [diff] [blame] | 289 | free(vec); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 290 | } |
| 291 | return 0; |
| 292 | } |
| 293 | |
Dmitry V. Levin | ece9ce6 | 2015-07-21 15:55:09 +0000 | [diff] [blame] | 294 | #if defined ALPHA || defined IA64 || defined M68K \ |
| 295 | || defined SPARC || defined SPARC64 |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 296 | SYS_FUNC(getpagesize) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 297 | { |
Dmitry V. Levin | b61b2d8 | 2016-01-08 19:20:05 +0000 | [diff] [blame] | 298 | return RVAL_DECODED | RVAL_HEX; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 299 | } |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 300 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 301 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 302 | SYS_FUNC(remap_file_pages) |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 303 | { |
Dmitry V. Levin | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 304 | const unsigned long addr = tcp->u_arg[0]; |
| 305 | const unsigned long size = tcp->u_arg[1]; |
| 306 | const unsigned long prot = tcp->u_arg[2]; |
| 307 | const unsigned long pgoff = tcp->u_arg[3]; |
| 308 | const unsigned long flags = tcp->u_arg[4]; |
| 309 | |
| 310 | printaddr(addr); |
| 311 | tprintf(", %lu, ", size); |
| 312 | printflags(mmap_prot, prot, "PROT_???"); |
| 313 | tprintf(", %lu, ", pgoff); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 314 | #ifdef MAP_TYPE |
Dmitry V. Levin | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 315 | printxval(mmap_flags, flags & MAP_TYPE, "MAP_???"); |
| 316 | addflags(mmap_flags, flags & ~MAP_TYPE); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 317 | #else |
Dmitry V. Levin | 3ae8690 | 2016-04-01 15:31:23 +0000 | [diff] [blame] | 318 | printflags(mmap_flags, flags, "MAP_???"); |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 319 | #endif |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 320 | |
| 321 | return RVAL_DECODED; |
Roland McGrath | 72c5b7b | 2003-03-05 04:08:00 +0000 | [diff] [blame] | 322 | } |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 323 | |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 324 | #define MPOL_DEFAULT 0 |
| 325 | #define MPOL_PREFERRED 1 |
| 326 | #define MPOL_BIND 2 |
| 327 | #define MPOL_INTERLEAVE 3 |
| 328 | |
| 329 | #define MPOL_F_NODE (1<<0) |
| 330 | #define MPOL_F_ADDR (1<<1) |
| 331 | |
| 332 | #define MPOL_MF_STRICT (1<<0) |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 333 | #define MPOL_MF_MOVE (1<<1) |
| 334 | #define MPOL_MF_MOVE_ALL (1<<2) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 335 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 336 | #include "xlat/policies.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 337 | #include "xlat/mbindflags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 338 | #include "xlat/mempolicyflags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 339 | #include "xlat/move_pages_flags.h" |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 340 | |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 341 | static void |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 342 | 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] | 343 | { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 344 | unsigned long nlongs, size, end; |
| 345 | |
| 346 | nlongs = (maxnodes + 8 * sizeof(long) - 1) / (8 * sizeof(long)); |
| 347 | size = nlongs * sizeof(long); |
| 348 | end = ptr + size; |
| 349 | if (nlongs == 0 || ((err || verbose(tcp)) && (size * 8 == maxnodes) |
| 350 | && (end > ptr))) { |
| 351 | unsigned long n, cur, abbrev_end; |
| 352 | int failed = 0; |
| 353 | |
| 354 | if (abbrev(tcp)) { |
| 355 | abbrev_end = ptr + max_strlen * sizeof(long); |
| 356 | if (abbrev_end < ptr) |
| 357 | abbrev_end = end; |
| 358 | } else { |
| 359 | abbrev_end = end; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 360 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 361 | tprints(", {"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 362 | for (cur = ptr; cur < end; cur += sizeof(long)) { |
| 363 | if (cur > ptr) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 364 | tprints(", "); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 365 | if (cur >= abbrev_end) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 366 | tprints("..."); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 367 | break; |
| 368 | } |
Denys Vlasenko | 7e69ed9 | 2015-03-21 19:50:53 +0100 | [diff] [blame] | 369 | if (umoven(tcp, cur, sizeof(n), &n) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 370 | tprints("?"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 371 | failed = 1; |
| 372 | break; |
| 373 | } |
| 374 | tprintf("%#0*lx", (int) sizeof(long) * 2 + 2, n); |
| 375 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 376 | tprints("}"); |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 377 | if (failed) { |
| 378 | tprints(" "); |
| 379 | printaddr(ptr); |
| 380 | } |
| 381 | } else { |
| 382 | tprints(" "); |
| 383 | printaddr(ptr); |
| 384 | } |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 385 | tprintf(", %lu", maxnodes); |
| 386 | } |
| 387 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 388 | SYS_FUNC(mbind) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 389 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 390 | printaddr(tcp->u_arg[0]); |
| 391 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 392 | printxval(policies, tcp->u_arg[2], "MPOL_???"); |
| 393 | get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[4], 0); |
| 394 | tprints(", "); |
| 395 | printflags(mbindflags, tcp->u_arg[5], "MPOL_???"); |
| 396 | |
| 397 | return RVAL_DECODED; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 398 | } |
| 399 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 400 | SYS_FUNC(set_mempolicy) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 401 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 402 | printxval(policies, tcp->u_arg[0], "MPOL_???"); |
| 403 | get_nodes(tcp, tcp->u_arg[1], tcp->u_arg[2], 0); |
| 404 | |
| 405 | return RVAL_DECODED; |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 406 | } |
| 407 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 408 | SYS_FUNC(get_mempolicy) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 409 | { |
| 410 | if (exiting(tcp)) { |
| 411 | int pol; |
Dmitry V. Levin | 2c389f6 | 2015-07-19 23:25:56 +0000 | [diff] [blame] | 412 | if (!umove_or_printaddr(tcp, tcp->u_arg[0], &pol)) |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 413 | printxval(policies, pol, "MPOL_???"); |
| 414 | 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] | 415 | tprints(", "); |
| 416 | printaddr(tcp->u_arg[3]); |
| 417 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 418 | printflags(mempolicyflags, tcp->u_arg[4], "MPOL_???"); |
Roland McGrath | b10a335 | 2004-10-07 18:53:12 +0000 | [diff] [blame] | 419 | } |
| 420 | return 0; |
| 421 | } |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 422 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 423 | SYS_FUNC(migrate_pages) |
Dmitry V. Levin | 64d0e71 | 2012-03-11 22:44:14 +0000 | [diff] [blame] | 424 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 425 | tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); |
| 426 | get_nodes(tcp, tcp->u_arg[2], tcp->u_arg[1], 0); |
| 427 | tprints(", "); |
| 428 | get_nodes(tcp, tcp->u_arg[3], tcp->u_arg[1], 0); |
| 429 | |
| 430 | return RVAL_DECODED; |
Dmitry V. Levin | 64d0e71 | 2012-03-11 22:44:14 +0000 | [diff] [blame] | 431 | } |
| 432 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 433 | SYS_FUNC(move_pages) |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 434 | { |
| 435 | if (entering(tcp)) { |
| 436 | unsigned long npages = tcp->u_arg[1]; |
| 437 | tprintf("%ld, %lu, ", tcp->u_arg[0], npages); |
| 438 | if (tcp->u_arg[2] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 439 | tprints("NULL, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 440 | else { |
Dmitry V. Levin | 3ed5d02 | 2014-09-10 13:46:04 +0000 | [diff] [blame] | 441 | unsigned int i; |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 442 | long puser = tcp->u_arg[2]; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 443 | tprints("{"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 444 | for (i = 0; i < npages; ++i) { |
| 445 | void *p; |
| 446 | if (i > 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 447 | tprints(", "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 448 | if (umove(tcp, puser, &p) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 449 | tprints("???"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 450 | break; |
| 451 | } |
| 452 | tprintf("%p", p); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 453 | puser += sizeof(void *); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 454 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 455 | tprints("}, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 456 | } |
| 457 | if (tcp->u_arg[3] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 458 | tprints("NULL, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 459 | else { |
Dmitry V. Levin | 3ed5d02 | 2014-09-10 13:46:04 +0000 | [diff] [blame] | 460 | unsigned int i; |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 461 | long nodeuser = tcp->u_arg[3]; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 462 | tprints("{"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 463 | for (i = 0; i < npages; ++i) { |
| 464 | int node; |
| 465 | if (i > 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 466 | tprints(", "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 467 | if (umove(tcp, nodeuser, &node) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 468 | tprints("???"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 469 | break; |
| 470 | } |
| 471 | tprintf("%#x", node); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 472 | nodeuser += sizeof(int); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 473 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 474 | tprints("}, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 475 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 476 | } else { |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 477 | unsigned long npages = tcp->u_arg[1]; |
| 478 | if (tcp->u_arg[4] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 479 | tprints("NULL, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 480 | else { |
Dmitry V. Levin | 3ed5d02 | 2014-09-10 13:46:04 +0000 | [diff] [blame] | 481 | unsigned int i; |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 482 | long statususer = tcp->u_arg[4]; |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 483 | tprints("{"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 484 | for (i = 0; i < npages; ++i) { |
| 485 | int status; |
| 486 | if (i > 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 487 | tprints(", "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 488 | if (umove(tcp, statususer, &status) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 489 | tprints("???"); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 490 | break; |
| 491 | } |
| 492 | tprintf("%#x", status); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 493 | statususer += sizeof(int); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 494 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 495 | tprints("}, "); |
Roland McGrath | 2c00a4a | 2007-07-24 01:52:58 +0000 | [diff] [blame] | 496 | } |
| 497 | printflags(move_pages_flags, tcp->u_arg[5], "MPOL_???"); |
| 498 | } |
| 499 | return 0; |
| 500 | } |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 501 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 502 | #if defined(POWERPC) |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 503 | SYS_FUNC(subpage_prot) |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 504 | { |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 505 | unsigned long cur, end, abbrev_end, entries; |
| 506 | unsigned int entry; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 507 | |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 508 | printaddr(tcp->u_arg[0]); |
| 509 | tprints(", "); |
| 510 | printaddr(tcp->u_arg[1]); |
| 511 | tprints(", "); |
| 512 | entries = tcp->u_arg[1] >> 16; |
| 513 | if (!entries || !tcp->u_arg[2]) { |
| 514 | tprints("{}"); |
| 515 | return 0; |
| 516 | } |
| 517 | cur = tcp->u_arg[2]; |
| 518 | end = cur + (sizeof(int) * entries); |
| 519 | if (!verbose(tcp) || end < (unsigned long) tcp->u_arg[2]) { |
| 520 | printaddr(tcp->u_arg[2]); |
| 521 | return 0; |
| 522 | } |
| 523 | if (abbrev(tcp)) { |
| 524 | abbrev_end = cur + (sizeof(int) * max_strlen); |
| 525 | if (abbrev_end > end) |
| 526 | abbrev_end = end; |
| 527 | } |
| 528 | else |
| 529 | abbrev_end = end; |
| 530 | tprints("{"); |
| 531 | for (; cur < end; cur += sizeof(int)) { |
| 532 | if (cur > (unsigned long) tcp->u_arg[2]) |
| 533 | tprints(", "); |
| 534 | if (cur >= abbrev_end) { |
| 535 | tprints("..."); |
| 536 | break; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 537 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 538 | if (umove(tcp, cur, &entry) < 0) { |
| 539 | tprintf("??? [%#lx]", cur); |
| 540 | break; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 541 | } |
| 542 | else |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 543 | tprintf("%#08x", entry); |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 544 | } |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 545 | tprints("}"); |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 546 | |
Dmitry V. Levin | 85813ce | 2015-07-19 23:37:40 +0000 | [diff] [blame] | 547 | return RVAL_DECODED; |
Roland McGrath | 4a6f652 | 2008-08-25 03:09:16 +0000 | [diff] [blame] | 548 | } |
| 549 | #endif |