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