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> |
| 6 | * Copyright (c) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation |
| 7 | * Linux for s390 port by D.J. Barrow |
| 8 | * <barrow_dj@mail.yahoo.com,djbarrow@de.ibm.com> |
Wichert Akkerman | ccef637 | 2002-05-01 16:39:22 +0000 | [diff] [blame] | 9 | * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH |
| 10 | * port by Greg Banks <gbanks@pocketpenguins.com> |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 11 | * |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 12 | * All rights reserved. |
| 13 | * |
| 14 | * Redistribution and use in source and binary forms, with or without |
| 15 | * modification, are permitted provided that the following conditions |
| 16 | * are met: |
| 17 | * 1. Redistributions of source code must retain the above copyright |
| 18 | * notice, this list of conditions and the following disclaimer. |
| 19 | * 2. Redistributions in binary form must reproduce the above copyright |
| 20 | * notice, this list of conditions and the following disclaimer in the |
| 21 | * documentation and/or other materials provided with the distribution. |
| 22 | * 3. The name of the author may not be used to endorse or promote products |
| 23 | * derived from this software without specific prior written permission. |
| 24 | * |
| 25 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 26 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 27 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 28 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 29 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 30 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 31 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 32 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 33 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 34 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 35 | */ |
| 36 | |
| 37 | #include "defs.h" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 38 | #include <fcntl.h> |
| 39 | #include <sys/stat.h> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 40 | #include <sys/wait.h> |
| 41 | #include <sys/resource.h> |
| 42 | #include <sys/utsname.h> |
| 43 | #include <sys/user.h> |
Dmitry V. Levin | c41808b | 2013-03-18 00:52:29 +0000 | [diff] [blame] | 44 | #ifdef HAVE_ELF_H |
| 45 | # include <elf.h> |
| 46 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 47 | |
Wichert Akkerman | 36915a1 | 1999-07-13 15:45:02 +0000 | [diff] [blame] | 48 | #ifdef HAVE_SYS_REG_H |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 49 | # include <sys/reg.h> |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 50 | # ifndef PTRACE_PEEKUSR |
| 51 | # define PTRACE_PEEKUSR PTRACE_PEEKUSER |
| 52 | # endif |
| 53 | # ifndef PTRACE_POKEUSR |
| 54 | # define PTRACE_POKEUSR PTRACE_POKEUSER |
| 55 | # endif |
Wichert Akkerman | 15dea97 | 1999-10-06 13:06:34 +0000 | [diff] [blame] | 56 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 57 | |
Roland McGrath | 5bd7cf8 | 2003-01-24 04:31:18 +0000 | [diff] [blame] | 58 | #ifdef HAVE_LINUX_PTRACE_H |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 59 | # undef PTRACE_SYSCALL |
Roland McGrath | fb1bc07 | 2004-03-01 21:29:24 +0000 | [diff] [blame] | 60 | # ifdef HAVE_STRUCT_IA64_FPREG |
| 61 | # define ia64_fpreg XXX_ia64_fpreg |
| 62 | # endif |
| 63 | # ifdef HAVE_STRUCT_PT_ALL_USER_REGS |
| 64 | # define pt_all_user_regs XXX_pt_all_user_regs |
| 65 | # endif |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 66 | # include <linux/ptrace.h> |
Roland McGrath | fb1bc07 | 2004-03-01 21:29:24 +0000 | [diff] [blame] | 67 | # undef ia64_fpreg |
| 68 | # undef pt_all_user_regs |
Roland McGrath | 5bd7cf8 | 2003-01-24 04:31:18 +0000 | [diff] [blame] | 69 | #endif |
| 70 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 71 | #if defined(SPARC64) |
Roland McGrath | 6d1a65c | 2004-07-12 07:44:08 +0000 | [diff] [blame] | 72 | # define r_pc r_tpc |
| 73 | # undef PTRACE_GETREGS |
| 74 | # define PTRACE_GETREGS PTRACE_GETREGS64 |
| 75 | # undef PTRACE_SETREGS |
| 76 | # define PTRACE_SETREGS PTRACE_SETREGS64 |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 77 | #endif |
Roland McGrath | 6d1a65c | 2004-07-12 07:44:08 +0000 | [diff] [blame] | 78 | |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 79 | #ifdef HAVE_LINUX_FUTEX_H |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 80 | # include <linux/futex.h> |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 81 | #endif |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 82 | #ifndef FUTEX_WAIT |
| 83 | # define FUTEX_WAIT 0 |
| 84 | #endif |
| 85 | #ifndef FUTEX_WAKE |
| 86 | # define FUTEX_WAKE 1 |
| 87 | #endif |
| 88 | #ifndef FUTEX_FD |
| 89 | # define FUTEX_FD 2 |
| 90 | #endif |
| 91 | #ifndef FUTEX_REQUEUE |
| 92 | # define FUTEX_REQUEUE 3 |
| 93 | #endif |
Wichert Akkerman | faf7222 | 2000-02-19 23:59:03 +0000 | [diff] [blame] | 94 | |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 95 | #include <sched.h> |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 96 | #include <asm/posix_types.h> |
| 97 | #undef GETGROUPS_T |
| 98 | #define GETGROUPS_T __kernel_gid_t |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 99 | #undef GETGROUPS32_T |
| 100 | #define GETGROUPS32_T __kernel_gid32_t |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 101 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 102 | #if defined(IA64) |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 103 | # include <asm/ptrace_offsets.h> |
| 104 | # include <asm/rse.h> |
| 105 | #endif |
| 106 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 107 | #ifdef HAVE_PRCTL |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 108 | # include <sys/prctl.h> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 109 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 110 | static const struct xlat prctl_options[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 111 | #ifdef PR_MAXPROCS |
| 112 | { PR_MAXPROCS, "PR_MAXPROCS" }, |
| 113 | #endif |
| 114 | #ifdef PR_ISBLOCKED |
| 115 | { PR_ISBLOCKED, "PR_ISBLOCKED" }, |
| 116 | #endif |
| 117 | #ifdef PR_SETSTACKSIZE |
| 118 | { PR_SETSTACKSIZE, "PR_SETSTACKSIZE" }, |
| 119 | #endif |
| 120 | #ifdef PR_GETSTACKSIZE |
| 121 | { PR_GETSTACKSIZE, "PR_GETSTACKSIZE" }, |
| 122 | #endif |
| 123 | #ifdef PR_MAXPPROCS |
| 124 | { PR_MAXPPROCS, "PR_MAXPPROCS" }, |
| 125 | #endif |
| 126 | #ifdef PR_UNBLKONEXEC |
| 127 | { PR_UNBLKONEXEC, "PR_UNBLKONEXEC" }, |
| 128 | #endif |
| 129 | #ifdef PR_ATOMICSIM |
| 130 | { PR_ATOMICSIM, "PR_ATOMICSIM" }, |
| 131 | #endif |
| 132 | #ifdef PR_SETEXITSIG |
| 133 | { PR_SETEXITSIG, "PR_SETEXITSIG" }, |
| 134 | #endif |
| 135 | #ifdef PR_RESIDENT |
| 136 | { PR_RESIDENT, "PR_RESIDENT" }, |
| 137 | #endif |
| 138 | #ifdef PR_ATTACHADDR |
| 139 | { PR_ATTACHADDR, "PR_ATTACHADDR" }, |
| 140 | #endif |
| 141 | #ifdef PR_DETACHADDR |
| 142 | { PR_DETACHADDR, "PR_DETACHADDR" }, |
| 143 | #endif |
| 144 | #ifdef PR_TERMCHILD |
| 145 | { PR_TERMCHILD, "PR_TERMCHILD" }, |
| 146 | #endif |
| 147 | #ifdef PR_GETSHMASK |
| 148 | { PR_GETSHMASK, "PR_GETSHMASK" }, |
| 149 | #endif |
| 150 | #ifdef PR_GETNSHARE |
| 151 | { PR_GETNSHARE, "PR_GETNSHARE" }, |
| 152 | #endif |
Wichert Akkerman | 8829a55 | 1999-06-11 13:18:40 +0000 | [diff] [blame] | 153 | #ifdef PR_COREPID |
| 154 | { PR_COREPID, "PR_COREPID" }, |
| 155 | #endif |
| 156 | #ifdef PR_ATTACHADDRPERM |
| 157 | { PR_ATTACHADDRPERM, "PR_ATTACHADDRPERM" }, |
| 158 | #endif |
| 159 | #ifdef PR_PTHREADEXIT |
| 160 | { PR_PTHREADEXIT, "PR_PTHREADEXIT" }, |
| 161 | #endif |
Dmitry V. Levin | b6593de | 2013-03-27 14:57:39 +0000 | [diff] [blame] | 162 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 163 | #ifdef PR_SET_PDEATHSIG |
| 164 | { PR_SET_PDEATHSIG, "PR_SET_PDEATHSIG" }, |
| 165 | #endif |
| 166 | #ifdef PR_GET_PDEATHSIG |
| 167 | { PR_GET_PDEATHSIG, "PR_GET_PDEATHSIG" }, |
| 168 | #endif |
Dmitry V. Levin | f02cf21 | 2008-09-03 00:54:40 +0000 | [diff] [blame] | 169 | #ifdef PR_GET_DUMPABLE |
| 170 | { PR_GET_DUMPABLE, "PR_GET_DUMPABLE" }, |
| 171 | #endif |
| 172 | #ifdef PR_SET_DUMPABLE |
| 173 | { PR_SET_DUMPABLE, "PR_SET_DUMPABLE" }, |
| 174 | #endif |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 175 | #ifdef PR_GET_UNALIGN |
| 176 | { PR_GET_UNALIGN, "PR_GET_UNALIGN" }, |
| 177 | #endif |
| 178 | #ifdef PR_SET_UNALIGN |
| 179 | { PR_SET_UNALIGN, "PR_SET_UNALIGN" }, |
| 180 | #endif |
| 181 | #ifdef PR_GET_KEEPCAPS |
Dmitry V. Levin | 8dd31dd | 2008-11-11 00:25:22 +0000 | [diff] [blame] | 182 | { PR_GET_KEEPCAPS, "PR_GET_KEEPCAPS" }, |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 183 | #endif |
| 184 | #ifdef PR_SET_KEEPCAPS |
Dmitry V. Levin | 8dd31dd | 2008-11-11 00:25:22 +0000 | [diff] [blame] | 185 | { PR_SET_KEEPCAPS, "PR_SET_KEEPCAPS" }, |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 186 | #endif |
Roland McGrath | e5039fb | 2007-11-03 23:58:07 +0000 | [diff] [blame] | 187 | #ifdef PR_GET_FPEMU |
| 188 | { PR_GET_FPEMU, "PR_GET_FPEMU" }, |
| 189 | #endif |
| 190 | #ifdef PR_SET_FPEMU |
| 191 | { PR_SET_FPEMU, "PR_SET_FPEMU" }, |
| 192 | #endif |
| 193 | #ifdef PR_GET_FPEXC |
| 194 | { PR_GET_FPEXC, "PR_GET_FPEXC" }, |
| 195 | #endif |
| 196 | #ifdef PR_SET_FPEXC |
| 197 | { PR_SET_FPEXC, "PR_SET_FPEXC" }, |
| 198 | #endif |
| 199 | #ifdef PR_GET_TIMING |
| 200 | { PR_GET_TIMING, "PR_GET_TIMING" }, |
| 201 | #endif |
| 202 | #ifdef PR_SET_TIMING |
| 203 | { PR_SET_TIMING, "PR_SET_TIMING" }, |
| 204 | #endif |
| 205 | #ifdef PR_SET_NAME |
| 206 | { PR_SET_NAME, "PR_SET_NAME" }, |
| 207 | #endif |
| 208 | #ifdef PR_GET_NAME |
| 209 | { PR_GET_NAME, "PR_GET_NAME" }, |
| 210 | #endif |
| 211 | #ifdef PR_GET_ENDIAN |
| 212 | { PR_GET_ENDIAN, "PR_GET_ENDIAN" }, |
| 213 | #endif |
| 214 | #ifdef PR_SET_ENDIAN |
| 215 | { PR_SET_ENDIAN, "PR_SET_ENDIAN" }, |
| 216 | #endif |
| 217 | #ifdef PR_GET_SECCOMP |
| 218 | { PR_GET_SECCOMP, "PR_GET_SECCOMP" }, |
| 219 | #endif |
| 220 | #ifdef PR_SET_SECCOMP |
| 221 | { PR_SET_SECCOMP, "PR_SET_SECCOMP" }, |
| 222 | #endif |
Dmitry V. Levin | b6593de | 2013-03-27 14:57:39 +0000 | [diff] [blame] | 223 | #ifdef PR_CAPBSET_READ |
| 224 | { PR_CAPBSET_READ, "PR_CAPBSET_READ" }, |
| 225 | #endif |
| 226 | #ifdef PR_CAPBSET_DROP |
| 227 | { PR_CAPBSET_DROP, "PR_CAPBSET_DROP" }, |
| 228 | #endif |
Dmitry V. Levin | 8dd31dd | 2008-11-11 00:25:22 +0000 | [diff] [blame] | 229 | #ifdef PR_GET_TSC |
| 230 | { PR_GET_TSC, "PR_GET_TSC" }, |
| 231 | #endif |
| 232 | #ifdef PR_SET_TSC |
| 233 | { PR_SET_TSC, "PR_SET_TSC" }, |
| 234 | #endif |
| 235 | #ifdef PR_GET_SECUREBITS |
| 236 | { PR_GET_SECUREBITS, "PR_GET_SECUREBITS" }, |
| 237 | #endif |
| 238 | #ifdef PR_SET_SECUREBITS |
| 239 | { PR_SET_SECUREBITS, "PR_SET_SECUREBITS" }, |
| 240 | #endif |
Dmitry V. Levin | b6593de | 2013-03-27 14:57:39 +0000 | [diff] [blame] | 241 | #ifdef PR_SET_TIMERSLACK |
| 242 | { PR_SET_TIMERSLACK, "PR_SET_TIMERSLACK" }, |
| 243 | #endif |
| 244 | #ifdef PR_GET_TIMERSLACK |
| 245 | { PR_GET_TIMERSLACK, "PR_GET_TIMERSLACK" }, |
| 246 | #endif |
| 247 | #ifdef PR_TASK_PERF_EVENTS_DISABLE |
| 248 | { PR_TASK_PERF_EVENTS_DISABLE, "PR_TASK_PERF_EVENTS_DISABLE" }, |
| 249 | #endif |
| 250 | #ifdef PR_TASK_PERF_EVENTS_ENABLE |
| 251 | { PR_TASK_PERF_EVENTS_ENABLE, "PR_TASK_PERF_EVENTS_ENABLE" }, |
| 252 | #endif |
| 253 | #ifdef PR_MCE_KILL |
| 254 | { PR_MCE_KILL, "PR_MCE_KILL" }, |
| 255 | #endif |
| 256 | #ifdef PR_MCE_KILL_GET |
| 257 | { PR_MCE_KILL_GET, "PR_MCE_KILL_GET" }, |
| 258 | #endif |
| 259 | #ifdef PR_SET_MM |
| 260 | { PR_SET_MM, "PR_SET_MM" }, |
| 261 | #endif |
Dmitry V. Levin | 7a0fb38 | 2013-05-13 18:34:15 +0000 | [diff] [blame] | 262 | #ifdef PR_SET_PTRACER |
| 263 | { PR_SET_PTRACER, "PR_SET_PTRACER" }, |
| 264 | #endif |
Dmitry V. Levin | b6593de | 2013-03-27 14:57:39 +0000 | [diff] [blame] | 265 | #ifdef PR_SET_CHILD_SUBREAPER |
| 266 | { PR_SET_CHILD_SUBREAPER, "PR_SET_CHILD_SUBREAPER" }, |
| 267 | #endif |
| 268 | #ifdef PR_GET_CHILD_SUBREAPER |
| 269 | { PR_GET_CHILD_SUBREAPER, "PR_GET_CHILD_SUBREAPER" }, |
| 270 | #endif |
| 271 | #ifdef PR_SET_NO_NEW_PRIVS |
| 272 | { PR_SET_NO_NEW_PRIVS, "PR_SET_NO_NEW_PRIVS" }, |
| 273 | #endif |
| 274 | #ifdef PR_GET_NO_NEW_PRIVS |
| 275 | { PR_GET_NO_NEW_PRIVS, "PR_GET_NO_NEW_PRIVS" }, |
| 276 | #endif |
| 277 | #ifdef PR_GET_TID_ADDRESS |
| 278 | { PR_GET_TID_ADDRESS, "PR_GET_TID_ADDRESS" }, |
| 279 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 280 | { 0, NULL }, |
| 281 | }; |
| 282 | |
Roland McGrath | a4d4853 | 2005-06-08 20:45:28 +0000 | [diff] [blame] | 283 | static const char * |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 284 | unalignctl_string(unsigned int ctl) |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 285 | { |
Denys Vlasenko | b237b1b | 2012-02-27 13:56:59 +0100 | [diff] [blame] | 286 | static char buf[sizeof(int)*2 + 2]; |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 287 | |
| 288 | switch (ctl) { |
| 289 | #ifdef PR_UNALIGN_NOPRINT |
Denys Vlasenko | b237b1b | 2012-02-27 13:56:59 +0100 | [diff] [blame] | 290 | case PR_UNALIGN_NOPRINT: |
| 291 | return "NOPRINT"; |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 292 | #endif |
| 293 | #ifdef PR_UNALIGN_SIGBUS |
Denys Vlasenko | b237b1b | 2012-02-27 13:56:59 +0100 | [diff] [blame] | 294 | case PR_UNALIGN_SIGBUS: |
| 295 | return "SIGBUS"; |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 296 | #endif |
Denys Vlasenko | b237b1b | 2012-02-27 13:56:59 +0100 | [diff] [blame] | 297 | default: |
| 298 | break; |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 299 | } |
| 300 | sprintf(buf, "%x", ctl); |
| 301 | return buf; |
| 302 | } |
| 303 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 304 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 305 | sys_prctl(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 306 | { |
| 307 | int i; |
| 308 | |
| 309 | if (entering(tcp)) { |
| 310 | printxval(prctl_options, tcp->u_arg[0], "PR_???"); |
| 311 | switch (tcp->u_arg[0]) { |
| 312 | #ifdef PR_GETNSHARE |
| 313 | case PR_GETNSHARE: |
| 314 | break; |
| 315 | #endif |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 316 | #ifdef PR_SET_PDEATHSIG |
| 317 | case PR_SET_PDEATHSIG: |
| 318 | tprintf(", %lu", tcp->u_arg[1]); |
| 319 | break; |
| 320 | #endif |
| 321 | #ifdef PR_GET_PDEATHSIG |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 322 | case PR_GET_PDEATHSIG: |
| 323 | break; |
| 324 | #endif |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 325 | #ifdef PR_SET_DUMPABLE |
| 326 | case PR_SET_DUMPABLE: |
| 327 | tprintf(", %lu", tcp->u_arg[1]); |
| 328 | break; |
| 329 | #endif |
| 330 | #ifdef PR_GET_DUMPABLE |
| 331 | case PR_GET_DUMPABLE: |
| 332 | break; |
| 333 | #endif |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 334 | #ifdef PR_SET_UNALIGN |
| 335 | case PR_SET_UNALIGN: |
| 336 | tprintf(", %s", unalignctl_string(tcp->u_arg[1])); |
| 337 | break; |
| 338 | #endif |
| 339 | #ifdef PR_GET_UNALIGN |
| 340 | case PR_GET_UNALIGN: |
| 341 | tprintf(", %#lx", tcp->u_arg[1]); |
| 342 | break; |
| 343 | #endif |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 344 | #ifdef PR_SET_KEEPCAPS |
| 345 | case PR_SET_KEEPCAPS: |
| 346 | tprintf(", %lu", tcp->u_arg[1]); |
| 347 | break; |
| 348 | #endif |
| 349 | #ifdef PR_GET_KEEPCAPS |
| 350 | case PR_GET_KEEPCAPS: |
| 351 | break; |
| 352 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 353 | default: |
Denys Vlasenko | 74ec14f | 2013-02-21 16:13:47 +0100 | [diff] [blame] | 354 | for (i = 1; i < tcp->s_ent->nargs; i++) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 355 | tprintf(", %#lx", tcp->u_arg[i]); |
| 356 | break; |
| 357 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 358 | } else { |
| 359 | switch (tcp->u_arg[0]) { |
| 360 | #ifdef PR_GET_PDEATHSIG |
| 361 | case PR_GET_PDEATHSIG: |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 362 | if (umove(tcp, tcp->u_arg[1], &i) < 0) |
| 363 | tprintf(", %#lx", tcp->u_arg[1]); |
| 364 | else |
| 365 | tprintf(", {%u}", i); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 366 | break; |
| 367 | #endif |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 368 | #ifdef PR_GET_DUMPABLE |
| 369 | case PR_GET_DUMPABLE: |
| 370 | return RVAL_UDECIMAL; |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 371 | #endif |
| 372 | #ifdef PR_GET_UNALIGN |
| 373 | case PR_GET_UNALIGN: |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 374 | if (syserror(tcp) || umove(tcp, tcp->u_arg[1], &i) < 0) |
| 375 | break; |
| 376 | tcp->auxstr = unalignctl_string(i); |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 377 | return RVAL_STR; |
Dmitry V. Levin | 50f6013 | 2008-09-03 00:56:52 +0000 | [diff] [blame] | 378 | #endif |
| 379 | #ifdef PR_GET_KEEPCAPS |
| 380 | case PR_GET_KEEPCAPS: |
| 381 | return RVAL_UDECIMAL; |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 382 | #endif |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 383 | default: |
| 384 | break; |
| 385 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 386 | } |
| 387 | return 0; |
| 388 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 389 | #endif /* HAVE_PRCTL */ |
| 390 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 391 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 392 | sys_sethostname(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 393 | { |
| 394 | if (entering(tcp)) { |
| 395 | printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]); |
| 396 | tprintf(", %lu", tcp->u_arg[1]); |
| 397 | } |
| 398 | return 0; |
| 399 | } |
| 400 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 401 | #if defined(ALPHA) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 402 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 403 | sys_gethostname(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 404 | { |
| 405 | if (exiting(tcp)) { |
| 406 | if (syserror(tcp)) |
| 407 | tprintf("%#lx", tcp->u_arg[0]); |
| 408 | else |
| 409 | printpath(tcp, tcp->u_arg[0]); |
| 410 | tprintf(", %lu", tcp->u_arg[1]); |
| 411 | } |
| 412 | return 0; |
| 413 | } |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 414 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 415 | |
| 416 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 417 | sys_setdomainname(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 418 | { |
| 419 | if (entering(tcp)) { |
| 420 | printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]); |
| 421 | tprintf(", %lu", tcp->u_arg[1]); |
| 422 | } |
| 423 | return 0; |
| 424 | } |
| 425 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 426 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 427 | sys_exit(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 428 | { |
| 429 | if (exiting(tcp)) { |
| 430 | fprintf(stderr, "_exit returned!\n"); |
| 431 | return -1; |
| 432 | } |
| 433 | /* special case: we stop tracing this process, finish line now */ |
| 434 | tprintf("%ld) ", tcp->u_arg[0]); |
Denys Vlasenko | 102ec49 | 2011-08-25 01:27:59 +0200 | [diff] [blame] | 435 | tabto(); |
Denys Vlasenko | 000b601 | 2012-01-28 01:25:03 +0100 | [diff] [blame] | 436 | tprints("= ?\n"); |
Denys Vlasenko | 7de265d | 2012-03-13 11:44:31 +0100 | [diff] [blame] | 437 | line_ended(); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 438 | return 0; |
| 439 | } |
| 440 | |
Wichert Akkerman | 7a0b649 | 1999-12-23 15:08:17 +0000 | [diff] [blame] | 441 | /* defines copied from linux/sched.h since we can't include that |
| 442 | * ourselves (it conflicts with *lots* of libc includes) |
| 443 | */ |
| 444 | #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */ |
| 445 | #define CLONE_VM 0x00000100 /* set if VM shared between processes */ |
| 446 | #define CLONE_FS 0x00000200 /* set if fs info shared between processes */ |
| 447 | #define CLONE_FILES 0x00000400 /* set if open files shared between processes */ |
| 448 | #define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */ |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 449 | #define CLONE_IDLETASK 0x00001000 /* kernel-only flag */ |
Wichert Akkerman | 7a0b649 | 1999-12-23 15:08:17 +0000 | [diff] [blame] | 450 | #define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */ |
| 451 | #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ |
| 452 | #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 453 | #define CLONE_THREAD 0x00010000 /* Same thread group? */ |
| 454 | #define CLONE_NEWNS 0x00020000 /* New namespace group? */ |
| 455 | #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
| 456 | #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ |
| 457 | #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ |
| 458 | #define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */ |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 459 | #define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */ |
| 460 | #define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ |
Dmitry V. Levin | e3d4b68 | 2010-12-03 17:19:51 +0000 | [diff] [blame] | 461 | #define CLONE_STOPPED 0x02000000 /* Start in stopped state */ |
| 462 | #define CLONE_NEWUTS 0x04000000 /* New utsname group? */ |
| 463 | #define CLONE_NEWIPC 0x08000000 /* New ipcs */ |
| 464 | #define CLONE_NEWUSER 0x10000000 /* New user namespace */ |
| 465 | #define CLONE_NEWPID 0x20000000 /* New pid namespace */ |
| 466 | #define CLONE_NEWNET 0x40000000 /* New network namespace */ |
| 467 | #define CLONE_IO 0x80000000 /* Clone io context */ |
Wichert Akkerman | 7a0b649 | 1999-12-23 15:08:17 +0000 | [diff] [blame] | 468 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 469 | static const struct xlat clone_flags[] = { |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 470 | { CLONE_VM, "CLONE_VM" }, |
| 471 | { CLONE_FS, "CLONE_FS" }, |
| 472 | { CLONE_FILES, "CLONE_FILES" }, |
| 473 | { CLONE_SIGHAND, "CLONE_SIGHAND" }, |
| 474 | { CLONE_IDLETASK, "CLONE_IDLETASK" }, |
| 475 | { CLONE_PTRACE, "CLONE_PTRACE" }, |
| 476 | { CLONE_VFORK, "CLONE_VFORK" }, |
| 477 | { CLONE_PARENT, "CLONE_PARENT" }, |
| 478 | { CLONE_THREAD, "CLONE_THREAD" }, |
| 479 | { CLONE_NEWNS, "CLONE_NEWNS" }, |
| 480 | { CLONE_SYSVSEM, "CLONE_SYSVSEM" }, |
| 481 | { CLONE_SETTLS, "CLONE_SETTLS" }, |
| 482 | { CLONE_PARENT_SETTID, "CLONE_PARENT_SETTID" }, |
| 483 | { CLONE_CHILD_CLEARTID, "CLONE_CHILD_CLEARTID" }, |
| 484 | { CLONE_UNTRACED, "CLONE_UNTRACED" }, |
| 485 | { CLONE_CHILD_SETTID, "CLONE_CHILD_SETTID" }, |
| 486 | { CLONE_STOPPED, "CLONE_STOPPED" }, |
| 487 | { CLONE_NEWUTS, "CLONE_NEWUTS" }, |
| 488 | { CLONE_NEWIPC, "CLONE_NEWIPC" }, |
| 489 | { CLONE_NEWUSER, "CLONE_NEWUSER" }, |
| 490 | { CLONE_NEWPID, "CLONE_NEWPID" }, |
| 491 | { CLONE_NEWNET, "CLONE_NEWNET" }, |
| 492 | { CLONE_IO, "CLONE_IO" }, |
| 493 | { 0, NULL }, |
Wichert Akkerman | 7a0b649 | 1999-12-23 15:08:17 +0000 | [diff] [blame] | 494 | }; |
| 495 | |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 496 | #ifdef I386 |
| 497 | # include <asm/ldt.h> |
| 498 | # ifdef HAVE_STRUCT_USER_DESC |
| 499 | # define modify_ldt_ldt_s user_desc |
| 500 | # endif |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 501 | extern void print_ldt_entry(); |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 502 | #endif |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 503 | |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 504 | #if defined IA64 |
| 505 | # define ARG_FLAGS 0 |
| 506 | # define ARG_STACK 1 |
| 507 | # define ARG_STACKSIZE (tcp->scno == SYS_clone2 ? 2 : -1) |
| 508 | # define ARG_PTID (tcp->scno == SYS_clone2 ? 3 : 2) |
| 509 | # define ARG_CTID (tcp->scno == SYS_clone2 ? 4 : 3) |
| 510 | # define ARG_TLS (tcp->scno == SYS_clone2 ? 5 : 4) |
| 511 | #elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32 |
| 512 | # define ARG_STACK 0 |
| 513 | # define ARG_FLAGS 1 |
| 514 | # define ARG_PTID 2 |
| 515 | # define ARG_CTID 3 |
| 516 | # define ARG_TLS 4 |
Christian Svensson | 492f81f | 2013-02-14 13:26:27 +0100 | [diff] [blame] | 517 | #elif defined X86_64 || defined X32 || defined ALPHA || defined TILE \ |
| 518 | || defined OR1K |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 519 | # define ARG_FLAGS 0 |
| 520 | # define ARG_STACK 1 |
| 521 | # define ARG_PTID 2 |
| 522 | # define ARG_CTID 3 |
| 523 | # define ARG_TLS 4 |
| 524 | #else |
| 525 | # define ARG_FLAGS 0 |
| 526 | # define ARG_STACK 1 |
| 527 | # define ARG_PTID 2 |
| 528 | # define ARG_TLS 3 |
| 529 | # define ARG_CTID 4 |
| 530 | #endif |
Roland McGrath | 9677b3a | 2003-03-12 09:54:36 +0000 | [diff] [blame] | 531 | |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 532 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 533 | sys_clone(struct tcb *tcp) |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 534 | { |
| 535 | if (exiting(tcp)) { |
Wang Chao | cbdd190 | 2010-09-02 15:08:59 +0800 | [diff] [blame] | 536 | const char *sep = "|"; |
Roland McGrath | 9677b3a | 2003-03-12 09:54:36 +0000 | [diff] [blame] | 537 | unsigned long flags = tcp->u_arg[ARG_FLAGS]; |
| 538 | tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]); |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 539 | #ifdef ARG_STACKSIZE |
Roland McGrath | 9677b3a | 2003-03-12 09:54:36 +0000 | [diff] [blame] | 540 | if (ARG_STACKSIZE != -1) |
| 541 | tprintf("stack_size=%#lx, ", |
| 542 | tcp->u_arg[ARG_STACKSIZE]); |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 543 | #endif |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 544 | tprints("flags="); |
Wang Chao | cbdd190 | 2010-09-02 15:08:59 +0800 | [diff] [blame] | 545 | if (!printflags(clone_flags, flags &~ CSIGNAL, NULL)) |
| 546 | sep = ""; |
Roland McGrath | 984154d | 2003-05-23 01:08:42 +0000 | [diff] [blame] | 547 | if ((flags & CSIGNAL) != 0) |
Wang Chao | cbdd190 | 2010-09-02 15:08:59 +0800 | [diff] [blame] | 548 | tprintf("%s%s", sep, signame(flags & CSIGNAL)); |
Roland McGrath | b4968be | 2003-01-20 09:04:33 +0000 | [diff] [blame] | 549 | if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID |
Roland McGrath | 9677b3a | 2003-03-12 09:54:36 +0000 | [diff] [blame] | 550 | |CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0) |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 551 | return 0; |
Roland McGrath | 6f67a98 | 2003-03-21 07:33:15 +0000 | [diff] [blame] | 552 | if (flags & CLONE_PARENT_SETTID) |
| 553 | tprintf(", parent_tidptr=%#lx", tcp->u_arg[ARG_PTID]); |
Roland McGrath | b4968be | 2003-01-20 09:04:33 +0000 | [diff] [blame] | 554 | if (flags & CLONE_SETTLS) { |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 555 | #ifdef I386 |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 556 | struct modify_ldt_ldt_s copy; |
Roland McGrath | 9677b3a | 2003-03-12 09:54:36 +0000 | [diff] [blame] | 557 | if (umove(tcp, tcp->u_arg[ARG_TLS], ©) != -1) { |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 558 | tprintf(", {entry_number:%d, ", |
| 559 | copy.entry_number); |
| 560 | if (!verbose(tcp)) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 561 | tprints("...}"); |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 562 | else |
| 563 | print_ldt_entry(©); |
| 564 | } |
| 565 | else |
Denys Vlasenko | a6d91de | 2012-03-16 12:02:22 +0100 | [diff] [blame] | 566 | #endif |
Roland McGrath | 43f2c84 | 2003-03-12 09:58:14 +0000 | [diff] [blame] | 567 | tprintf(", tls=%#lx", tcp->u_arg[ARG_TLS]); |
Roland McGrath | 909875b | 2002-12-22 03:34:36 +0000 | [diff] [blame] | 568 | } |
Roland McGrath | 9677b3a | 2003-03-12 09:54:36 +0000 | [diff] [blame] | 569 | if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID)) |
| 570 | tprintf(", child_tidptr=%#lx", tcp->u_arg[ARG_CTID]); |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 571 | } |
Denys Vlasenko | d083016 | 2013-06-28 18:57:27 +0200 | [diff] [blame^] | 572 | /* TODO on syscall entry: |
| 573 | * We can clear CLONE_PTRACE here since it is an ancient hack |
| 574 | * to allow us to catch children, and we use another hack for that. |
| 575 | * But CLONE_PTRACE can conceivably be used by malicious programs |
| 576 | * to subvert us. By clearing this bit, we can defend against it: |
| 577 | * in untraced execution, CLONE_PTRACE should have no effect. |
| 578 | * |
| 579 | * We can also clear CLONE_UNTRACED, since it allows to start |
| 580 | * children outside of our control. At the moment |
| 581 | * I'm trying to figure out whether there is a *legitimate* |
| 582 | * use of this flag which we should respect. |
| 583 | */ |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 584 | return 0; |
| 585 | } |
Dmitry V. Levin | 95ebf5a | 2006-10-13 20:25:12 +0000 | [diff] [blame] | 586 | |
| 587 | int |
| 588 | sys_unshare(struct tcb *tcp) |
| 589 | { |
| 590 | if (entering(tcp)) |
| 591 | printflags(clone_flags, tcp->u_arg[0], "CLONE_???"); |
| 592 | return 0; |
| 593 | } |
Wichert Akkerman | 7a0b649 | 1999-12-23 15:08:17 +0000 | [diff] [blame] | 594 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 595 | int |
Denys Vlasenko | 081533c | 2012-03-17 02:17:51 +0100 | [diff] [blame] | 596 | sys_fork(struct tcb *tcp) |
| 597 | { |
| 598 | if (exiting(tcp)) |
| 599 | return RVAL_UDECIMAL; |
| 600 | return 0; |
| 601 | } |
| 602 | |
| 603 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 604 | sys_vfork(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 605 | { |
| 606 | if (exiting(tcp)) |
| 607 | return RVAL_UDECIMAL; |
| 608 | return 0; |
| 609 | } |
| 610 | |
Dmitry V. Levin | 50a218d | 2011-01-18 17:36:20 +0000 | [diff] [blame] | 611 | int sys_getuid(struct tcb *tcp) |
| 612 | { |
| 613 | if (exiting(tcp)) |
| 614 | tcp->u_rval = (uid_t) tcp->u_rval; |
| 615 | return RVAL_UDECIMAL; |
| 616 | } |
| 617 | |
| 618 | int sys_setfsuid(struct tcb *tcp) |
| 619 | { |
| 620 | if (entering(tcp)) |
| 621 | tprintf("%u", (uid_t) tcp->u_arg[0]); |
| 622 | else |
| 623 | tcp->u_rval = (uid_t) tcp->u_rval; |
| 624 | return RVAL_UDECIMAL; |
| 625 | } |
| 626 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 627 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 628 | sys_setuid(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 629 | { |
| 630 | if (entering(tcp)) { |
| 631 | tprintf("%u", (uid_t) tcp->u_arg[0]); |
| 632 | } |
| 633 | return 0; |
| 634 | } |
| 635 | |
| 636 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 637 | sys_getresuid(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 638 | { |
| 639 | if (exiting(tcp)) { |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 640 | __kernel_uid_t uid; |
| 641 | if (syserror(tcp)) |
| 642 | tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0], |
| 643 | tcp->u_arg[1], tcp->u_arg[2]); |
| 644 | else { |
| 645 | if (umove(tcp, tcp->u_arg[0], &uid) < 0) |
| 646 | tprintf("%#lx, ", tcp->u_arg[0]); |
| 647 | else |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 648 | tprintf("[%lu], ", (unsigned long) uid); |
Roland McGrath | 9bd6b42 | 2003-02-24 07:13:51 +0000 | [diff] [blame] | 649 | if (umove(tcp, tcp->u_arg[1], &uid) < 0) |
| 650 | tprintf("%#lx, ", tcp->u_arg[1]); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 651 | else |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 652 | tprintf("[%lu], ", (unsigned long) uid); |
Roland McGrath | 9bd6b42 | 2003-02-24 07:13:51 +0000 | [diff] [blame] | 653 | if (umove(tcp, tcp->u_arg[2], &uid) < 0) |
| 654 | tprintf("%#lx", tcp->u_arg[2]); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 655 | else |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 656 | tprintf("[%lu]", (unsigned long) uid); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 657 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 658 | } |
| 659 | return 0; |
| 660 | } |
| 661 | |
| 662 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 663 | sys_setreuid(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 664 | { |
| 665 | if (entering(tcp)) { |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 666 | printuid("", tcp->u_arg[0]); |
| 667 | printuid(", ", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 668 | } |
| 669 | return 0; |
| 670 | } |
| 671 | |
| 672 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 673 | sys_setresuid(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 674 | { |
| 675 | if (entering(tcp)) { |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 676 | printuid("", tcp->u_arg[0]); |
| 677 | printuid(", ", tcp->u_arg[1]); |
| 678 | printuid(", ", tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 679 | } |
| 680 | return 0; |
| 681 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 682 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 683 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 684 | sys_setgroups(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 685 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 686 | if (entering(tcp)) { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 687 | unsigned long len, size, start, cur, end, abbrev_end; |
| 688 | GETGROUPS_T gid; |
| 689 | int failed = 0; |
| 690 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 691 | len = tcp->u_arg[0]; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 692 | tprintf("%lu, ", len); |
| 693 | if (len == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 694 | tprints("[]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 695 | return 0; |
| 696 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 697 | start = tcp->u_arg[1]; |
| 698 | if (start == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 699 | tprints("NULL"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 700 | return 0; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 701 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 702 | size = len * sizeof(gid); |
| 703 | end = start + size; |
| 704 | if (!verbose(tcp) || size / sizeof(gid) != len || end < start) { |
| 705 | tprintf("%#lx", start); |
| 706 | return 0; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 707 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 708 | if (abbrev(tcp)) { |
| 709 | abbrev_end = start + max_strlen * sizeof(gid); |
| 710 | if (abbrev_end < start) |
| 711 | abbrev_end = end; |
| 712 | } else { |
| 713 | abbrev_end = end; |
| 714 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 715 | tprints("["); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 716 | for (cur = start; cur < end; cur += sizeof(gid)) { |
| 717 | if (cur > start) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 718 | tprints(", "); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 719 | if (cur >= abbrev_end) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 720 | tprints("..."); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 721 | break; |
| 722 | } |
| 723 | if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 724 | tprints("?"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 725 | failed = 1; |
| 726 | break; |
| 727 | } |
| 728 | tprintf("%lu", (unsigned long) gid); |
| 729 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 730 | tprints("]"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 731 | if (failed) |
| 732 | tprintf(" %#lx", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 733 | } |
| 734 | return 0; |
| 735 | } |
| 736 | |
| 737 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 738 | sys_getgroups(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 739 | { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 740 | unsigned long len; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 741 | |
| 742 | if (entering(tcp)) { |
| 743 | len = tcp->u_arg[0]; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 744 | tprintf("%lu, ", len); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 745 | } else { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 746 | unsigned long size, start, cur, end, abbrev_end; |
| 747 | GETGROUPS_T gid; |
| 748 | int failed = 0; |
| 749 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 750 | len = tcp->u_rval; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 751 | if (len == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 752 | tprints("[]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 753 | return 0; |
| 754 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 755 | start = tcp->u_arg[1]; |
| 756 | if (start == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 757 | tprints("NULL"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 758 | return 0; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 759 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 760 | if (tcp->u_arg[0] == 0) { |
| 761 | tprintf("%#lx", start); |
| 762 | return 0; |
| 763 | } |
| 764 | size = len * sizeof(gid); |
| 765 | end = start + size; |
| 766 | if (!verbose(tcp) || tcp->u_arg[0] == 0 || |
| 767 | size / sizeof(gid) != len || end < start) { |
| 768 | tprintf("%#lx", start); |
| 769 | return 0; |
| 770 | } |
| 771 | if (abbrev(tcp)) { |
| 772 | abbrev_end = start + max_strlen * sizeof(gid); |
| 773 | if (abbrev_end < start) |
| 774 | abbrev_end = end; |
| 775 | } else { |
| 776 | abbrev_end = end; |
| 777 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 778 | tprints("["); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 779 | for (cur = start; cur < end; cur += sizeof(gid)) { |
| 780 | if (cur > start) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 781 | tprints(", "); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 782 | if (cur >= abbrev_end) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 783 | tprints("..."); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 784 | break; |
| 785 | } |
| 786 | if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 787 | tprints("?"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 788 | failed = 1; |
| 789 | break; |
| 790 | } |
| 791 | tprintf("%lu", (unsigned long) gid); |
| 792 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 793 | tprints("]"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 794 | if (failed) |
| 795 | tprintf(" %#lx", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 796 | } |
| 797 | return 0; |
| 798 | } |
| 799 | |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 800 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 801 | sys_setgroups32(struct tcb *tcp) |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 802 | { |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 803 | if (entering(tcp)) { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 804 | unsigned long len, size, start, cur, end, abbrev_end; |
| 805 | GETGROUPS32_T gid; |
| 806 | int failed = 0; |
| 807 | |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 808 | len = tcp->u_arg[0]; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 809 | tprintf("%lu, ", len); |
| 810 | if (len == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 811 | tprints("[]"); |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 812 | return 0; |
| 813 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 814 | start = tcp->u_arg[1]; |
| 815 | if (start == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 816 | tprints("NULL"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 817 | return 0; |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 818 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 819 | size = len * sizeof(gid); |
| 820 | end = start + size; |
| 821 | if (!verbose(tcp) || size / sizeof(gid) != len || end < start) { |
| 822 | tprintf("%#lx", start); |
| 823 | return 0; |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 824 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 825 | if (abbrev(tcp)) { |
| 826 | abbrev_end = start + max_strlen * sizeof(gid); |
| 827 | if (abbrev_end < start) |
| 828 | abbrev_end = end; |
| 829 | } else { |
| 830 | abbrev_end = end; |
| 831 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 832 | tprints("["); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 833 | for (cur = start; cur < end; cur += sizeof(gid)) { |
| 834 | if (cur > start) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 835 | tprints(", "); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 836 | if (cur >= abbrev_end) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 837 | tprints("..."); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 838 | break; |
| 839 | } |
| 840 | if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 841 | tprints("?"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 842 | failed = 1; |
| 843 | break; |
| 844 | } |
| 845 | tprintf("%lu", (unsigned long) gid); |
| 846 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 847 | tprints("]"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 848 | if (failed) |
| 849 | tprintf(" %#lx", tcp->u_arg[1]); |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 850 | } |
| 851 | return 0; |
| 852 | } |
| 853 | |
| 854 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 855 | sys_getgroups32(struct tcb *tcp) |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 856 | { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 857 | unsigned long len; |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 858 | |
| 859 | if (entering(tcp)) { |
| 860 | len = tcp->u_arg[0]; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 861 | tprintf("%lu, ", len); |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 862 | } else { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 863 | unsigned long size, start, cur, end, abbrev_end; |
| 864 | GETGROUPS32_T gid; |
| 865 | int failed = 0; |
| 866 | |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 867 | len = tcp->u_rval; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 868 | if (len == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 869 | tprints("[]"); |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 870 | return 0; |
| 871 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 872 | start = tcp->u_arg[1]; |
| 873 | if (start == 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 874 | tprints("NULL"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 875 | return 0; |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 876 | } |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 877 | size = len * sizeof(gid); |
| 878 | end = start + size; |
| 879 | if (!verbose(tcp) || tcp->u_arg[0] == 0 || |
| 880 | size / sizeof(gid) != len || end < start) { |
| 881 | tprintf("%#lx", start); |
| 882 | return 0; |
| 883 | } |
| 884 | if (abbrev(tcp)) { |
| 885 | abbrev_end = start + max_strlen * sizeof(gid); |
| 886 | if (abbrev_end < start) |
| 887 | abbrev_end = end; |
| 888 | } else { |
| 889 | abbrev_end = end; |
| 890 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 891 | tprints("["); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 892 | for (cur = start; cur < end; cur += sizeof(gid)) { |
| 893 | if (cur > start) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 894 | tprints(", "); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 895 | if (cur >= abbrev_end) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 896 | tprints("..."); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 897 | break; |
| 898 | } |
| 899 | if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 900 | tprints("?"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 901 | failed = 1; |
| 902 | break; |
| 903 | } |
| 904 | tprintf("%lu", (unsigned long) gid); |
| 905 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 906 | tprints("]"); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 907 | if (failed) |
| 908 | tprintf(" %#lx", tcp->u_arg[1]); |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 909 | } |
| 910 | return 0; |
| 911 | } |
Roland McGrath | 83bd47a | 2003-11-13 22:32:26 +0000 | [diff] [blame] | 912 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 913 | static void |
Dmitry V. Levin | 30145dd | 2010-09-06 22:08:24 +0000 | [diff] [blame] | 914 | printargv(struct tcb *tcp, long addr) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 915 | { |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 916 | union { |
Andreas Schwab | 99c8569 | 2009-08-28 19:36:20 +0200 | [diff] [blame] | 917 | unsigned int p32; |
| 918 | unsigned long p64; |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 919 | char data[sizeof(long)]; |
| 920 | } cp; |
Dmitry V. Levin | 30145dd | 2010-09-06 22:08:24 +0000 | [diff] [blame] | 921 | const char *sep; |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 922 | int n = 0; |
Denys Vlasenko | 9fd4f96 | 2012-03-19 09:36:42 +0100 | [diff] [blame] | 923 | unsigned wordsize = current_wordsize; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 924 | |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 925 | cp.p64 = 1; |
| 926 | for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) { |
Denys Vlasenko | 1945ccc | 2012-02-27 14:37:48 +0100 | [diff] [blame] | 927 | if (umoven(tcp, addr, wordsize, cp.data) < 0) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 928 | tprintf("%#lx", addr); |
| 929 | return; |
| 930 | } |
Denys Vlasenko | 1945ccc | 2012-02-27 14:37:48 +0100 | [diff] [blame] | 931 | if (wordsize == 4) |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 932 | cp.p64 = cp.p32; |
| 933 | if (cp.p64 == 0) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 934 | break; |
Denys Vlasenko | 5940e65 | 2011-09-01 09:55:05 +0200 | [diff] [blame] | 935 | tprints(sep); |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 936 | printstr(tcp, cp.p64, -1); |
Denys Vlasenko | 1945ccc | 2012-02-27 14:37:48 +0100 | [diff] [blame] | 937 | addr += wordsize; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 938 | } |
Roland McGrath | 85a3bc4 | 2007-08-02 02:13:05 +0000 | [diff] [blame] | 939 | if (cp.p64) |
| 940 | tprintf("%s...", sep); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 941 | } |
| 942 | |
| 943 | static void |
Dmitry V. Levin | 30145dd | 2010-09-06 22:08:24 +0000 | [diff] [blame] | 944 | printargc(const char *fmt, struct tcb *tcp, long addr) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 945 | { |
| 946 | int count; |
| 947 | char *cp; |
| 948 | |
| 949 | for (count = 0; umove(tcp, addr, &cp) >= 0 && cp != NULL; count++) { |
| 950 | addr += sizeof(char *); |
| 951 | } |
| 952 | tprintf(fmt, count, count == 1 ? "" : "s"); |
| 953 | } |
| 954 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 955 | #if defined(SPARC) || defined(SPARC64) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 956 | int |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 957 | sys_execv(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 958 | { |
| 959 | if (entering(tcp)) { |
| 960 | printpath(tcp, tcp->u_arg[0]); |
| 961 | if (!verbose(tcp)) |
| 962 | tprintf(", %#lx", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 963 | else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 964 | tprints(", ["); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 965 | printargv(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 966 | tprints("]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 967 | } |
| 968 | } |
| 969 | return 0; |
| 970 | } |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 971 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 972 | |
| 973 | int |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 974 | sys_execve(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 975 | { |
| 976 | if (entering(tcp)) { |
| 977 | printpath(tcp, tcp->u_arg[0]); |
| 978 | if (!verbose(tcp)) |
| 979 | tprintf(", %#lx", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 980 | else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 981 | tprints(", ["); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 982 | printargv(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 983 | tprints("]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 984 | } |
| 985 | if (!verbose(tcp)) |
| 986 | tprintf(", %#lx", tcp->u_arg[2]); |
| 987 | else if (abbrev(tcp)) |
| 988 | printargc(", [/* %d var%s */]", tcp, tcp->u_arg[2]); |
| 989 | else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 990 | tprints(", ["); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 991 | printargv(tcp, tcp->u_arg[2]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 992 | tprints("]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 993 | } |
| 994 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 995 | return 0; |
| 996 | } |
| 997 | |
Roland McGrath | 7ec1d35 | 2002-12-17 04:50:44 +0000 | [diff] [blame] | 998 | #ifndef __WNOTHREAD |
| 999 | #define __WNOTHREAD 0x20000000 |
| 1000 | #endif |
| 1001 | #ifndef __WALL |
| 1002 | #define __WALL 0x40000000 |
| 1003 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1004 | #ifndef __WCLONE |
Roland McGrath | 7ec1d35 | 2002-12-17 04:50:44 +0000 | [diff] [blame] | 1005 | #define __WCLONE 0x80000000 |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1006 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1007 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 1008 | static const struct xlat wait4_options[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1009 | { WNOHANG, "WNOHANG" }, |
| 1010 | #ifndef WSTOPPED |
| 1011 | { WUNTRACED, "WUNTRACED" }, |
| 1012 | #endif |
| 1013 | #ifdef WEXITED |
| 1014 | { WEXITED, "WEXITED" }, |
| 1015 | #endif |
| 1016 | #ifdef WTRAPPED |
| 1017 | { WTRAPPED, "WTRAPPED" }, |
| 1018 | #endif |
| 1019 | #ifdef WSTOPPED |
| 1020 | { WSTOPPED, "WSTOPPED" }, |
| 1021 | #endif |
| 1022 | #ifdef WCONTINUED |
| 1023 | { WCONTINUED, "WCONTINUED" }, |
| 1024 | #endif |
| 1025 | #ifdef WNOWAIT |
| 1026 | { WNOWAIT, "WNOWAIT" }, |
| 1027 | #endif |
| 1028 | #ifdef __WCLONE |
| 1029 | { __WCLONE, "__WCLONE" }, |
| 1030 | #endif |
Roland McGrath | 7ec1d35 | 2002-12-17 04:50:44 +0000 | [diff] [blame] | 1031 | #ifdef __WALL |
| 1032 | { __WALL, "__WALL" }, |
| 1033 | #endif |
| 1034 | #ifdef __WNOTHREAD |
| 1035 | { __WNOTHREAD, "__WNOTHREAD" }, |
| 1036 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1037 | { 0, NULL }, |
| 1038 | }; |
| 1039 | |
Roland McGrath | 5e02a57 | 2004-10-19 23:33:47 +0000 | [diff] [blame] | 1040 | #if !defined WCOREFLAG && defined WCOREFLG |
| 1041 | # define WCOREFLAG WCOREFLG |
| 1042 | #endif |
| 1043 | #ifndef WCOREFLAG |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 1044 | # define WCOREFLAG 0x80 |
Roland McGrath | 5e02a57 | 2004-10-19 23:33:47 +0000 | [diff] [blame] | 1045 | #endif |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 1046 | #ifndef WCOREDUMP |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1047 | # define WCOREDUMP(status) ((status) & 0200) |
Dmitry V. Levin | e5e6085 | 2009-12-31 22:50:49 +0000 | [diff] [blame] | 1048 | #endif |
Roland McGrath | 5e02a57 | 2004-10-19 23:33:47 +0000 | [diff] [blame] | 1049 | #ifndef W_STOPCODE |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1050 | # define W_STOPCODE(sig) ((sig) << 8 | 0x7f) |
Roland McGrath | 5e02a57 | 2004-10-19 23:33:47 +0000 | [diff] [blame] | 1051 | #endif |
| 1052 | #ifndef W_EXITCODE |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1053 | # define W_EXITCODE(ret, sig) ((ret) << 8 | (sig)) |
Roland McGrath | 5e02a57 | 2004-10-19 23:33:47 +0000 | [diff] [blame] | 1054 | #endif |
| 1055 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1056 | static int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 1057 | printstatus(int status) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1058 | { |
| 1059 | int exited = 0; |
| 1060 | |
| 1061 | /* |
| 1062 | * Here is a tricky presentation problem. This solution |
| 1063 | * is still not entirely satisfactory but since there |
| 1064 | * are no wait status constructors it will have to do. |
| 1065 | */ |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1066 | if (WIFSTOPPED(status)) { |
| 1067 | tprintf("[{WIFSTOPPED(s) && WSTOPSIG(s) == %s}", |
Nate Sammons | ce780fc | 1999-03-29 23:23:13 +0000 | [diff] [blame] | 1068 | signame(WSTOPSIG(status))); |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1069 | status &= ~W_STOPCODE(WSTOPSIG(status)); |
| 1070 | } |
| 1071 | else if (WIFSIGNALED(status)) { |
| 1072 | tprintf("[{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}", |
Nate Sammons | ce780fc | 1999-03-29 23:23:13 +0000 | [diff] [blame] | 1073 | signame(WTERMSIG(status)), |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1074 | WCOREDUMP(status) ? " && WCOREDUMP(s)" : ""); |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1075 | status &= ~(W_EXITCODE(0, WTERMSIG(status)) | WCOREFLAG); |
| 1076 | } |
| 1077 | else if (WIFEXITED(status)) { |
| 1078 | tprintf("[{WIFEXITED(s) && WEXITSTATUS(s) == %d}", |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1079 | WEXITSTATUS(status)); |
| 1080 | exited = 1; |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1081 | status &= ~W_EXITCODE(WEXITSTATUS(status), 0); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1082 | } |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1083 | else { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1084 | tprintf("[%#x]", status); |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1085 | return 0; |
| 1086 | } |
| 1087 | |
| 1088 | if (status == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1089 | tprints("]"); |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1090 | else |
Roland McGrath | f8cc83c | 2004-06-04 01:24:07 +0000 | [diff] [blame] | 1091 | tprintf(" | %#x]", status); |
Roland McGrath | 79fbda5 | 2004-04-14 02:45:55 +0000 | [diff] [blame] | 1092 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1093 | return exited; |
| 1094 | } |
| 1095 | |
| 1096 | static int |
Denys Vlasenko | 59432db | 2009-01-26 19:09:35 +0000 | [diff] [blame] | 1097 | printwaitn(struct tcb *tcp, int n, int bitness) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1098 | { |
| 1099 | int status; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1100 | |
| 1101 | if (entering(tcp)) { |
Denys Vlasenko | e740fd3 | 2009-04-16 12:06:16 +0000 | [diff] [blame] | 1102 | /* On Linux, kernel-side pid_t is typedef'ed to int |
| 1103 | * on all arches. Also, glibc-2.8 truncates wait3 and wait4 |
Denys Vlasenko | 59432db | 2009-01-26 19:09:35 +0000 | [diff] [blame] | 1104 | * pid argument to int on 64bit arches, producing, |
| 1105 | * for example, wait4(4294967295, ...) instead of -1 |
Denys Vlasenko | e740fd3 | 2009-04-16 12:06:16 +0000 | [diff] [blame] | 1106 | * in strace. We have to use int here, not long. |
| 1107 | */ |
| 1108 | int pid = tcp->u_arg[0]; |
| 1109 | tprintf("%d, ", pid); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1110 | } else { |
| 1111 | /* status */ |
| 1112 | if (!tcp->u_arg[1]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1113 | tprints("NULL"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1114 | else if (syserror(tcp) || tcp->u_rval == 0) |
| 1115 | tprintf("%#lx", tcp->u_arg[1]); |
| 1116 | else if (umove(tcp, tcp->u_arg[1], &status) < 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1117 | tprints("[?]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1118 | else |
Dmitry V. Levin | d9a4b0a | 2011-02-23 00:27:12 +0000 | [diff] [blame] | 1119 | printstatus(status); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1120 | /* options */ |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1121 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1122 | printflags(wait4_options, tcp->u_arg[2], "W???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1123 | if (n == 4) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1124 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1125 | /* usage */ |
| 1126 | if (!tcp->u_arg[3]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1127 | tprints("NULL"); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1128 | else if (tcp->u_rval > 0) { |
Denys Vlasenko | 59432db | 2009-01-26 19:09:35 +0000 | [diff] [blame] | 1129 | #ifdef ALPHA |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1130 | if (bitness) |
| 1131 | printrusage32(tcp, tcp->u_arg[3]); |
| 1132 | else |
| 1133 | #endif |
| 1134 | printrusage(tcp, tcp->u_arg[3]); |
| 1135 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1136 | else |
| 1137 | tprintf("%#lx", tcp->u_arg[3]); |
| 1138 | } |
| 1139 | } |
| 1140 | return 0; |
| 1141 | } |
| 1142 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1143 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 1144 | sys_waitpid(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1145 | { |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1146 | return printwaitn(tcp, 3, 0); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1147 | } |
| 1148 | |
| 1149 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 1150 | sys_wait4(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1151 | { |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1152 | return printwaitn(tcp, 4, 0); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1153 | } |
| 1154 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1155 | #ifdef ALPHA |
| 1156 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 1157 | sys_osf_wait4(struct tcb *tcp) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 1158 | { |
| 1159 | return printwaitn(tcp, 4, 1); |
| 1160 | } |
| 1161 | #endif |
| 1162 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 1163 | static const struct xlat waitid_types[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1164 | { P_PID, "P_PID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1165 | #ifdef P_PPID |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1166 | { P_PPID, "P_PPID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1167 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1168 | { P_PGID, "P_PGID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1169 | #ifdef P_SID |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1170 | { P_SID, "P_SID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1171 | #endif |
| 1172 | #ifdef P_CID |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1173 | { P_CID, "P_CID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1174 | #endif |
| 1175 | #ifdef P_UID |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1176 | { P_UID, "P_UID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1177 | #endif |
| 1178 | #ifdef P_GID |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1179 | { P_GID, "P_GID" }, |
Roland McGrath | c74c0b7 | 2004-09-01 19:39:46 +0000 | [diff] [blame] | 1180 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1181 | { P_ALL, "P_ALL" }, |
| 1182 | #ifdef P_LWPID |
| 1183 | { P_LWPID, "P_LWPID" }, |
| 1184 | #endif |
| 1185 | { 0, NULL }, |
| 1186 | }; |
| 1187 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1188 | int |
Dmitry V. Levin | 3eb9491 | 2010-09-09 23:08:59 +0000 | [diff] [blame] | 1189 | sys_waitid(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1190 | { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1191 | if (entering(tcp)) { |
| 1192 | printxval(waitid_types, tcp->u_arg[0], "P_???"); |
| 1193 | tprintf(", %ld, ", tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1194 | } |
| 1195 | else { |
| 1196 | /* siginfo */ |
Denys Vlasenko | d4d3ede | 2013-02-13 16:31:32 +0100 | [diff] [blame] | 1197 | printsiginfo_at(tcp, tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1198 | /* options */ |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1199 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 1200 | printflags(wait4_options, tcp->u_arg[3], "W???"); |
Denys Vlasenko | 74ec14f | 2013-02-21 16:13:47 +0100 | [diff] [blame] | 1201 | if (tcp->s_ent->nargs > 4) { |
Roland McGrath | 39426a3 | 2004-10-06 22:02:59 +0000 | [diff] [blame] | 1202 | /* usage */ |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1203 | tprints(", "); |
Roland McGrath | 39426a3 | 2004-10-06 22:02:59 +0000 | [diff] [blame] | 1204 | if (!tcp->u_arg[4]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1205 | tprints("NULL"); |
Roland McGrath | 39426a3 | 2004-10-06 22:02:59 +0000 | [diff] [blame] | 1206 | else if (tcp->u_error) |
| 1207 | tprintf("%#lx", tcp->u_arg[4]); |
| 1208 | else |
| 1209 | printrusage(tcp, tcp->u_arg[4]); |
| 1210 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1211 | } |
| 1212 | return 0; |
| 1213 | } |
| 1214 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1215 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 1216 | sys_uname(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1217 | { |
| 1218 | struct utsname uname; |
| 1219 | |
| 1220 | if (exiting(tcp)) { |
| 1221 | if (syserror(tcp) || !verbose(tcp)) |
| 1222 | tprintf("%#lx", tcp->u_arg[0]); |
| 1223 | else if (umove(tcp, tcp->u_arg[0], &uname) < 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1224 | tprints("{...}"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1225 | else if (!abbrev(tcp)) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1226 | tprintf("{sysname=\"%s\", nodename=\"%s\", ", |
| 1227 | uname.sysname, uname.nodename); |
| 1228 | tprintf("release=\"%s\", version=\"%s\", ", |
| 1229 | uname.release, uname.version); |
| 1230 | tprintf("machine=\"%s\"", uname.machine); |
Dmitry V. Levin | ea22e97 | 2012-05-01 20:56:32 +0000 | [diff] [blame] | 1231 | #ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1232 | tprintf(", domainname=\"%s\"", uname.domainname); |
Denys Vlasenko | c7e8371 | 2009-02-24 12:59:47 +0000 | [diff] [blame] | 1233 | #endif |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 1234 | tprints("}"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1235 | } |
| 1236 | else |
| 1237 | tprintf("{sys=\"%s\", node=\"%s\", ...}", |
| 1238 | uname.sysname, uname.nodename); |
| 1239 | } |
| 1240 | return 0; |
| 1241 | } |
| 1242 | |
Roland McGrath | eb9e2e8 | 2009-06-02 16:49:22 -0700 | [diff] [blame] | 1243 | static const struct xlat ptrace_cmds[] = { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1244 | { PTRACE_TRACEME, "PTRACE_TRACEME" }, |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1245 | { PTRACE_PEEKTEXT, "PTRACE_PEEKTEXT" }, |
| 1246 | { PTRACE_PEEKDATA, "PTRACE_PEEKDATA" }, |
| 1247 | { PTRACE_PEEKUSER, "PTRACE_PEEKUSER" }, |
| 1248 | { PTRACE_POKETEXT, "PTRACE_POKETEXT" }, |
| 1249 | { PTRACE_POKEDATA, "PTRACE_POKEDATA" }, |
| 1250 | { PTRACE_POKEUSER, "PTRACE_POKEUSER" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1251 | { PTRACE_CONT, "PTRACE_CONT" }, |
| 1252 | { PTRACE_KILL, "PTRACE_KILL" }, |
| 1253 | { PTRACE_SINGLESTEP, "PTRACE_SINGLESTEP" }, |
| 1254 | { PTRACE_ATTACH, "PTRACE_ATTACH" }, |
| 1255 | { PTRACE_DETACH, "PTRACE_DETACH" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1256 | #ifdef PTRACE_GETREGS |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1257 | { PTRACE_GETREGS, "PTRACE_GETREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1258 | #endif |
| 1259 | #ifdef PTRACE_SETREGS |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1260 | { PTRACE_SETREGS, "PTRACE_SETREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1261 | #endif |
| 1262 | #ifdef PTRACE_GETFPREGS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1263 | { PTRACE_GETFPREGS, "PTRACE_GETFPREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1264 | #endif |
| 1265 | #ifdef PTRACE_SETFPREGS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1266 | { PTRACE_SETFPREGS, "PTRACE_SETFPREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1267 | #endif |
| 1268 | #ifdef PTRACE_GETFPXREGS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1269 | { PTRACE_GETFPXREGS, "PTRACE_GETFPXREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1270 | #endif |
| 1271 | #ifdef PTRACE_SETFPXREGS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1272 | { PTRACE_SETFPXREGS, "PTRACE_SETFPXREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1273 | #endif |
| 1274 | #ifdef PTRACE_GETVRREGS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1275 | { PTRACE_GETVRREGS, "PTRACE_GETVRREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1276 | #endif |
| 1277 | #ifdef PTRACE_SETVRREGS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1278 | { PTRACE_SETVRREGS, "PTRACE_SETVRREGS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1279 | #endif |
| 1280 | #ifdef PTRACE_SETOPTIONS |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1281 | { PTRACE_SETOPTIONS, "PTRACE_SETOPTIONS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1282 | #endif |
| 1283 | #ifdef PTRACE_GETEVENTMSG |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1284 | { PTRACE_GETEVENTMSG, "PTRACE_GETEVENTMSG" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1285 | #endif |
| 1286 | #ifdef PTRACE_GETSIGINFO |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1287 | { PTRACE_GETSIGINFO, "PTRACE_GETSIGINFO" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1288 | #endif |
| 1289 | #ifdef PTRACE_SETSIGINFO |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1290 | { PTRACE_SETSIGINFO, "PTRACE_SETSIGINFO" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1291 | #endif |
| 1292 | #ifdef PTRACE_GETREGSET |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1293 | { PTRACE_GETREGSET, "PTRACE_GETREGSET" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1294 | #endif |
| 1295 | #ifdef PTRACE_SETREGSET |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1296 | { PTRACE_SETREGSET, "PTRACE_SETREGSET" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1297 | #endif |
| 1298 | #ifdef PTRACE_SET_SYSCALL |
Denys Vlasenko | 61526c6 | 2011-08-25 10:21:13 +0200 | [diff] [blame] | 1299 | { PTRACE_SET_SYSCALL, "PTRACE_SET_SYSCALL" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1300 | #endif |
| 1301 | #ifdef PTRACE_SEIZE |
Denys Vlasenko | 31fa8a2 | 2012-01-29 02:01:44 +0100 | [diff] [blame] | 1302 | { PTRACE_SEIZE, "PTRACE_SEIZE" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1303 | #endif |
| 1304 | #ifdef PTRACE_INTERRUPT |
Denys Vlasenko | 31fa8a2 | 2012-01-29 02:01:44 +0100 | [diff] [blame] | 1305 | { PTRACE_INTERRUPT, "PTRACE_INTERRUPT" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1306 | #endif |
| 1307 | #ifdef PTRACE_LISTEN |
Denys Vlasenko | 31fa8a2 | 2012-01-29 02:01:44 +0100 | [diff] [blame] | 1308 | { PTRACE_LISTEN, "PTRACE_LISTEN" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1309 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1310 | { PTRACE_SYSCALL, "PTRACE_SYSCALL" }, |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1311 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1312 | { 0, NULL }, |
| 1313 | }; |
| 1314 | |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1315 | #ifdef PTRACE_SETOPTIONS |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1316 | static const struct xlat ptrace_setoptions_flags[] = { |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1317 | # ifdef PTRACE_O_TRACESYSGOOD |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1318 | { PTRACE_O_TRACESYSGOOD,"PTRACE_O_TRACESYSGOOD" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1319 | # endif |
| 1320 | # ifdef PTRACE_O_TRACEFORK |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1321 | { PTRACE_O_TRACEFORK, "PTRACE_O_TRACEFORK" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1322 | # endif |
| 1323 | # ifdef PTRACE_O_TRACEVFORK |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1324 | { PTRACE_O_TRACEVFORK, "PTRACE_O_TRACEVFORK" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1325 | # endif |
| 1326 | # ifdef PTRACE_O_TRACECLONE |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1327 | { PTRACE_O_TRACECLONE, "PTRACE_O_TRACECLONE" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1328 | # endif |
| 1329 | # ifdef PTRACE_O_TRACEEXEC |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1330 | { PTRACE_O_TRACEEXEC, "PTRACE_O_TRACEEXEC" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1331 | # endif |
| 1332 | # ifdef PTRACE_O_TRACEVFORKDONE |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1333 | { PTRACE_O_TRACEVFORKDONE,"PTRACE_O_TRACEVFORKDONE"}, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1334 | # endif |
| 1335 | # ifdef PTRACE_O_TRACEEXIT |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1336 | { PTRACE_O_TRACEEXIT, "PTRACE_O_TRACEEXIT" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1337 | # endif |
Dmitry V. Levin | f782201 | 2013-05-17 22:22:19 +0000 | [diff] [blame] | 1338 | # ifdef PTRACE_O_TRACESECCOMP |
| 1339 | { PTRACE_O_TRACESECCOMP,"PTRACE_O_TRACESECCOMP" }, |
| 1340 | # endif |
| 1341 | # ifdef PTRACE_O_EXITKILL |
| 1342 | { PTRACE_O_EXITKILL, "PTRACE_O_EXITKILL" }, |
| 1343 | # endif |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1344 | { 0, NULL }, |
| 1345 | }; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1346 | #endif /* PTRACE_SETOPTIONS */ |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 1347 | |
Dmitry V. Levin | c41808b | 2013-03-18 00:52:29 +0000 | [diff] [blame] | 1348 | static const struct xlat nt_descriptor_types[] = { |
| 1349 | #ifdef NT_PRSTATUS |
| 1350 | { NT_PRSTATUS, "NT_PRSTATUS" }, |
| 1351 | #endif |
| 1352 | #ifdef NT_FPREGSET |
| 1353 | { NT_FPREGSET, "NT_FPREGSET" }, |
| 1354 | #endif |
| 1355 | #ifdef NT_PRPSINFO |
| 1356 | { NT_PRPSINFO, "NT_PRPSINFO" }, |
| 1357 | #endif |
| 1358 | #ifdef NT_PRXREG |
| 1359 | { NT_PRXREG, "NT_PRXREG" }, |
| 1360 | #endif |
| 1361 | #ifdef NT_TASKSTRUCT |
| 1362 | { NT_TASKSTRUCT, "NT_TASKSTRUCT" }, |
| 1363 | #endif |
| 1364 | #ifdef NT_PLATFORM |
| 1365 | { NT_PLATFORM, "NT_PLATFORM" }, |
| 1366 | #endif |
| 1367 | #ifdef NT_AUXV |
| 1368 | { NT_AUXV, "NT_AUXV" }, |
| 1369 | #endif |
| 1370 | #ifdef NT_GWINDOWS |
| 1371 | { NT_GWINDOWS, "NT_GWINDOWS" }, |
| 1372 | #endif |
| 1373 | #ifdef NT_ASRS |
| 1374 | { NT_ASRS, "NT_ASRS" }, |
| 1375 | #endif |
| 1376 | #ifdef NT_PSTATUS |
| 1377 | { NT_PSTATUS, "NT_PSTATUS" }, |
| 1378 | #endif |
| 1379 | #ifdef NT_PSINFO |
| 1380 | { NT_PSINFO, "NT_PSINFO" }, |
| 1381 | #endif |
| 1382 | #ifdef NT_PRCRED |
| 1383 | { NT_PRCRED, "NT_PRCRED" }, |
| 1384 | #endif |
| 1385 | #ifdef NT_UTSNAME |
| 1386 | { NT_UTSNAME, "NT_UTSNAME" }, |
| 1387 | #endif |
| 1388 | #ifdef NT_LWPSTATUS |
| 1389 | { NT_LWPSTATUS, "NT_LWPSTATUS" }, |
| 1390 | #endif |
| 1391 | #ifdef NT_LWPSINFO |
| 1392 | { NT_LWPSINFO, "NT_LWPSINFO" }, |
| 1393 | #endif |
| 1394 | #ifdef NT_PRFPXREG |
| 1395 | { NT_PRFPXREG, "NT_PRFPXREG" }, |
| 1396 | #endif |
| 1397 | #ifdef NT_PRXFPREG |
| 1398 | { NT_PRXFPREG, "NT_PRXFPREG" }, |
| 1399 | #endif |
| 1400 | #ifdef NT_PPC_VMX |
| 1401 | { NT_PPC_VMX, "NT_PPC_VMX" }, |
| 1402 | #endif |
| 1403 | #ifdef NT_PPC_SPE |
| 1404 | { NT_PPC_SPE, "NT_PPC_SPE" }, |
| 1405 | #endif |
| 1406 | #ifdef NT_PPC_VSX |
| 1407 | { NT_PPC_VSX, "NT_PPC_VSX" }, |
| 1408 | #endif |
| 1409 | #ifdef NT_386_TLS |
| 1410 | { NT_386_TLS, "NT_386_TLS" }, |
| 1411 | #endif |
| 1412 | #ifdef NT_386_IOPERM |
| 1413 | { NT_386_IOPERM, "NT_386_IOPERM" }, |
| 1414 | #endif |
| 1415 | #ifdef NT_X86_XSTATE |
| 1416 | { NT_X86_XSTATE, "NT_X86_XSTATE" }, |
| 1417 | #endif |
| 1418 | { 0, NULL }, |
| 1419 | }; |
| 1420 | |
Denys Vlasenko | 513e9c2 | 2012-03-21 14:39:22 +0100 | [diff] [blame] | 1421 | #define uoff(member) offsetof(struct user, member) |
| 1422 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 1423 | const struct xlat struct_user_offsets[] = { |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1424 | #if defined(S390) || defined(S390X) |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 1425 | { PT_PSWMASK, "psw_mask" }, |
| 1426 | { PT_PSWADDR, "psw_addr" }, |
| 1427 | { PT_GPR0, "gpr0" }, |
| 1428 | { PT_GPR1, "gpr1" }, |
| 1429 | { PT_GPR2, "gpr2" }, |
| 1430 | { PT_GPR3, "gpr3" }, |
| 1431 | { PT_GPR4, "gpr4" }, |
| 1432 | { PT_GPR5, "gpr5" }, |
| 1433 | { PT_GPR6, "gpr6" }, |
| 1434 | { PT_GPR7, "gpr7" }, |
| 1435 | { PT_GPR8, "gpr8" }, |
| 1436 | { PT_GPR9, "gpr9" }, |
| 1437 | { PT_GPR10, "gpr10" }, |
| 1438 | { PT_GPR11, "gpr11" }, |
| 1439 | { PT_GPR12, "gpr12" }, |
| 1440 | { PT_GPR13, "gpr13" }, |
| 1441 | { PT_GPR14, "gpr14" }, |
| 1442 | { PT_GPR15, "gpr15" }, |
| 1443 | { PT_ACR0, "acr0" }, |
| 1444 | { PT_ACR1, "acr1" }, |
| 1445 | { PT_ACR2, "acr2" }, |
| 1446 | { PT_ACR3, "acr3" }, |
| 1447 | { PT_ACR4, "acr4" }, |
| 1448 | { PT_ACR5, "acr5" }, |
| 1449 | { PT_ACR6, "acr6" }, |
| 1450 | { PT_ACR7, "acr7" }, |
| 1451 | { PT_ACR8, "acr8" }, |
| 1452 | { PT_ACR9, "acr9" }, |
| 1453 | { PT_ACR10, "acr10" }, |
| 1454 | { PT_ACR11, "acr11" }, |
| 1455 | { PT_ACR12, "acr12" }, |
| 1456 | { PT_ACR13, "acr13" }, |
| 1457 | { PT_ACR14, "acr14" }, |
| 1458 | { PT_ACR15, "acr15" }, |
| 1459 | { PT_ORIGGPR2, "orig_gpr2" }, |
| 1460 | { PT_FPC, "fpc" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1461 | #if defined(S390) |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 1462 | { PT_FPR0_HI, "fpr0.hi" }, |
| 1463 | { PT_FPR0_LO, "fpr0.lo" }, |
| 1464 | { PT_FPR1_HI, "fpr1.hi" }, |
| 1465 | { PT_FPR1_LO, "fpr1.lo" }, |
| 1466 | { PT_FPR2_HI, "fpr2.hi" }, |
| 1467 | { PT_FPR2_LO, "fpr2.lo" }, |
| 1468 | { PT_FPR3_HI, "fpr3.hi" }, |
| 1469 | { PT_FPR3_LO, "fpr3.lo" }, |
| 1470 | { PT_FPR4_HI, "fpr4.hi" }, |
| 1471 | { PT_FPR4_LO, "fpr4.lo" }, |
| 1472 | { PT_FPR5_HI, "fpr5.hi" }, |
| 1473 | { PT_FPR5_LO, "fpr5.lo" }, |
| 1474 | { PT_FPR6_HI, "fpr6.hi" }, |
| 1475 | { PT_FPR6_LO, "fpr6.lo" }, |
| 1476 | { PT_FPR7_HI, "fpr7.hi" }, |
| 1477 | { PT_FPR7_LO, "fpr7.lo" }, |
| 1478 | { PT_FPR8_HI, "fpr8.hi" }, |
| 1479 | { PT_FPR8_LO, "fpr8.lo" }, |
| 1480 | { PT_FPR9_HI, "fpr9.hi" }, |
| 1481 | { PT_FPR9_LO, "fpr9.lo" }, |
| 1482 | { PT_FPR10_HI, "fpr10.hi" }, |
| 1483 | { PT_FPR10_LO, "fpr10.lo" }, |
| 1484 | { PT_FPR11_HI, "fpr11.hi" }, |
| 1485 | { PT_FPR11_LO, "fpr11.lo" }, |
| 1486 | { PT_FPR12_HI, "fpr12.hi" }, |
| 1487 | { PT_FPR12_LO, "fpr12.lo" }, |
| 1488 | { PT_FPR13_HI, "fpr13.hi" }, |
| 1489 | { PT_FPR13_LO, "fpr13.lo" }, |
| 1490 | { PT_FPR14_HI, "fpr14.hi" }, |
| 1491 | { PT_FPR14_LO, "fpr14.lo" }, |
| 1492 | { PT_FPR15_HI, "fpr15.hi" }, |
| 1493 | { PT_FPR15_LO, "fpr15.lo" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1494 | #endif |
| 1495 | #if defined(S390X) |
Michal Ludvig | 10a88d0 | 2002-10-07 14:31:00 +0000 | [diff] [blame] | 1496 | { PT_FPR0, "fpr0" }, |
| 1497 | { PT_FPR1, "fpr1" }, |
| 1498 | { PT_FPR2, "fpr2" }, |
| 1499 | { PT_FPR3, "fpr3" }, |
| 1500 | { PT_FPR4, "fpr4" }, |
| 1501 | { PT_FPR5, "fpr5" }, |
| 1502 | { PT_FPR6, "fpr6" }, |
| 1503 | { PT_FPR7, "fpr7" }, |
| 1504 | { PT_FPR8, "fpr8" }, |
| 1505 | { PT_FPR9, "fpr9" }, |
| 1506 | { PT_FPR10, "fpr10" }, |
| 1507 | { PT_FPR11, "fpr11" }, |
| 1508 | { PT_FPR12, "fpr12" }, |
| 1509 | { PT_FPR13, "fpr13" }, |
| 1510 | { PT_FPR14, "fpr14" }, |
| 1511 | { PT_FPR15, "fpr15" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1512 | #endif |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 1513 | { PT_CR_9, "cr9" }, |
| 1514 | { PT_CR_10, "cr10" }, |
| 1515 | { PT_CR_11, "cr11" }, |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1516 | { PT_IEEE_IP, "ieee_exception_ip" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1517 | #elif defined(SPARC) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1518 | /* XXX No support for these offsets yet. */ |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1519 | #elif defined(HPPA) |
Wichert Akkerman | c1652e2 | 2001-03-27 12:17:16 +0000 | [diff] [blame] | 1520 | /* XXX No support for these offsets yet. */ |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1521 | #elif defined(POWERPC) |
| 1522 | # ifndef PT_ORIG_R3 |
| 1523 | # define PT_ORIG_R3 34 |
| 1524 | # endif |
| 1525 | # define REGSIZE (sizeof(unsigned long)) |
Roland McGrath | eb28535 | 2003-01-14 09:59:00 +0000 | [diff] [blame] | 1526 | { REGSIZE*PT_R0, "r0" }, |
| 1527 | { REGSIZE*PT_R1, "r1" }, |
| 1528 | { REGSIZE*PT_R2, "r2" }, |
| 1529 | { REGSIZE*PT_R3, "r3" }, |
| 1530 | { REGSIZE*PT_R4, "r4" }, |
| 1531 | { REGSIZE*PT_R5, "r5" }, |
| 1532 | { REGSIZE*PT_R6, "r6" }, |
| 1533 | { REGSIZE*PT_R7, "r7" }, |
| 1534 | { REGSIZE*PT_R8, "r8" }, |
| 1535 | { REGSIZE*PT_R9, "r9" }, |
| 1536 | { REGSIZE*PT_R10, "r10" }, |
| 1537 | { REGSIZE*PT_R11, "r11" }, |
| 1538 | { REGSIZE*PT_R12, "r12" }, |
| 1539 | { REGSIZE*PT_R13, "r13" }, |
| 1540 | { REGSIZE*PT_R14, "r14" }, |
| 1541 | { REGSIZE*PT_R15, "r15" }, |
| 1542 | { REGSIZE*PT_R16, "r16" }, |
| 1543 | { REGSIZE*PT_R17, "r17" }, |
| 1544 | { REGSIZE*PT_R18, "r18" }, |
| 1545 | { REGSIZE*PT_R19, "r19" }, |
| 1546 | { REGSIZE*PT_R20, "r20" }, |
| 1547 | { REGSIZE*PT_R21, "r21" }, |
| 1548 | { REGSIZE*PT_R22, "r22" }, |
| 1549 | { REGSIZE*PT_R23, "r23" }, |
| 1550 | { REGSIZE*PT_R24, "r24" }, |
| 1551 | { REGSIZE*PT_R25, "r25" }, |
| 1552 | { REGSIZE*PT_R26, "r26" }, |
| 1553 | { REGSIZE*PT_R27, "r27" }, |
| 1554 | { REGSIZE*PT_R28, "r28" }, |
| 1555 | { REGSIZE*PT_R29, "r29" }, |
| 1556 | { REGSIZE*PT_R30, "r30" }, |
| 1557 | { REGSIZE*PT_R31, "r31" }, |
| 1558 | { REGSIZE*PT_NIP, "NIP" }, |
| 1559 | { REGSIZE*PT_MSR, "MSR" }, |
| 1560 | { REGSIZE*PT_ORIG_R3, "ORIG_R3" }, |
| 1561 | { REGSIZE*PT_CTR, "CTR" }, |
| 1562 | { REGSIZE*PT_LNK, "LNK" }, |
| 1563 | { REGSIZE*PT_XER, "XER" }, |
| 1564 | { REGSIZE*PT_CCR, "CCR" }, |
| 1565 | { REGSIZE*PT_FPR0, "FPR0" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1566 | # undef REGSIZE |
| 1567 | #elif defined(ALPHA) |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 1568 | { 0, "r0" }, |
| 1569 | { 1, "r1" }, |
| 1570 | { 2, "r2" }, |
| 1571 | { 3, "r3" }, |
| 1572 | { 4, "r4" }, |
| 1573 | { 5, "r5" }, |
| 1574 | { 6, "r6" }, |
| 1575 | { 7, "r7" }, |
| 1576 | { 8, "r8" }, |
| 1577 | { 9, "r9" }, |
| 1578 | { 10, "r10" }, |
| 1579 | { 11, "r11" }, |
| 1580 | { 12, "r12" }, |
| 1581 | { 13, "r13" }, |
| 1582 | { 14, "r14" }, |
| 1583 | { 15, "r15" }, |
| 1584 | { 16, "r16" }, |
| 1585 | { 17, "r17" }, |
| 1586 | { 18, "r18" }, |
| 1587 | { 19, "r19" }, |
| 1588 | { 20, "r20" }, |
| 1589 | { 21, "r21" }, |
| 1590 | { 22, "r22" }, |
| 1591 | { 23, "r23" }, |
| 1592 | { 24, "r24" }, |
| 1593 | { 25, "r25" }, |
| 1594 | { 26, "r26" }, |
| 1595 | { 27, "r27" }, |
| 1596 | { 28, "r28" }, |
| 1597 | { 29, "gp" }, |
| 1598 | { 30, "fp" }, |
| 1599 | { 31, "zero" }, |
| 1600 | { 32, "fp0" }, |
| 1601 | { 33, "fp" }, |
| 1602 | { 34, "fp2" }, |
| 1603 | { 35, "fp3" }, |
| 1604 | { 36, "fp4" }, |
| 1605 | { 37, "fp5" }, |
| 1606 | { 38, "fp6" }, |
| 1607 | { 39, "fp7" }, |
| 1608 | { 40, "fp8" }, |
| 1609 | { 41, "fp9" }, |
| 1610 | { 42, "fp10" }, |
| 1611 | { 43, "fp11" }, |
| 1612 | { 44, "fp12" }, |
| 1613 | { 45, "fp13" }, |
| 1614 | { 46, "fp14" }, |
| 1615 | { 47, "fp15" }, |
| 1616 | { 48, "fp16" }, |
| 1617 | { 49, "fp17" }, |
| 1618 | { 50, "fp18" }, |
| 1619 | { 51, "fp19" }, |
| 1620 | { 52, "fp20" }, |
| 1621 | { 53, "fp21" }, |
| 1622 | { 54, "fp22" }, |
| 1623 | { 55, "fp23" }, |
| 1624 | { 56, "fp24" }, |
| 1625 | { 57, "fp25" }, |
| 1626 | { 58, "fp26" }, |
| 1627 | { 59, "fp27" }, |
| 1628 | { 60, "fp28" }, |
| 1629 | { 61, "fp29" }, |
| 1630 | { 62, "fp30" }, |
| 1631 | { 63, "fp31" }, |
| 1632 | { 64, "pc" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1633 | #elif defined(IA64) |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 1634 | { PT_F32, "f32" }, { PT_F33, "f33" }, { PT_F34, "f34" }, |
| 1635 | { PT_F35, "f35" }, { PT_F36, "f36" }, { PT_F37, "f37" }, |
| 1636 | { PT_F38, "f38" }, { PT_F39, "f39" }, { PT_F40, "f40" }, |
| 1637 | { PT_F41, "f41" }, { PT_F42, "f42" }, { PT_F43, "f43" }, |
| 1638 | { PT_F44, "f44" }, { PT_F45, "f45" }, { PT_F46, "f46" }, |
| 1639 | { PT_F47, "f47" }, { PT_F48, "f48" }, { PT_F49, "f49" }, |
| 1640 | { PT_F50, "f50" }, { PT_F51, "f51" }, { PT_F52, "f52" }, |
| 1641 | { PT_F53, "f53" }, { PT_F54, "f54" }, { PT_F55, "f55" }, |
| 1642 | { PT_F56, "f56" }, { PT_F57, "f57" }, { PT_F58, "f58" }, |
| 1643 | { PT_F59, "f59" }, { PT_F60, "f60" }, { PT_F61, "f61" }, |
| 1644 | { PT_F62, "f62" }, { PT_F63, "f63" }, { PT_F64, "f64" }, |
| 1645 | { PT_F65, "f65" }, { PT_F66, "f66" }, { PT_F67, "f67" }, |
| 1646 | { PT_F68, "f68" }, { PT_F69, "f69" }, { PT_F70, "f70" }, |
| 1647 | { PT_F71, "f71" }, { PT_F72, "f72" }, { PT_F73, "f73" }, |
| 1648 | { PT_F74, "f74" }, { PT_F75, "f75" }, { PT_F76, "f76" }, |
| 1649 | { PT_F77, "f77" }, { PT_F78, "f78" }, { PT_F79, "f79" }, |
| 1650 | { PT_F80, "f80" }, { PT_F81, "f81" }, { PT_F82, "f82" }, |
| 1651 | { PT_F83, "f83" }, { PT_F84, "f84" }, { PT_F85, "f85" }, |
| 1652 | { PT_F86, "f86" }, { PT_F87, "f87" }, { PT_F88, "f88" }, |
| 1653 | { PT_F89, "f89" }, { PT_F90, "f90" }, { PT_F91, "f91" }, |
| 1654 | { PT_F92, "f92" }, { PT_F93, "f93" }, { PT_F94, "f94" }, |
| 1655 | { PT_F95, "f95" }, { PT_F96, "f96" }, { PT_F97, "f97" }, |
| 1656 | { PT_F98, "f98" }, { PT_F99, "f99" }, { PT_F100, "f100" }, |
| 1657 | { PT_F101, "f101" }, { PT_F102, "f102" }, { PT_F103, "f103" }, |
| 1658 | { PT_F104, "f104" }, { PT_F105, "f105" }, { PT_F106, "f106" }, |
| 1659 | { PT_F107, "f107" }, { PT_F108, "f108" }, { PT_F109, "f109" }, |
| 1660 | { PT_F110, "f110" }, { PT_F111, "f111" }, { PT_F112, "f112" }, |
| 1661 | { PT_F113, "f113" }, { PT_F114, "f114" }, { PT_F115, "f115" }, |
| 1662 | { PT_F116, "f116" }, { PT_F117, "f117" }, { PT_F118, "f118" }, |
| 1663 | { PT_F119, "f119" }, { PT_F120, "f120" }, { PT_F121, "f121" }, |
| 1664 | { PT_F122, "f122" }, { PT_F123, "f123" }, { PT_F124, "f124" }, |
| 1665 | { PT_F125, "f125" }, { PT_F126, "f126" }, { PT_F127, "f127" }, |
| 1666 | /* switch stack: */ |
| 1667 | { PT_F2, "f2" }, { PT_F3, "f3" }, { PT_F4, "f4" }, |
| 1668 | { PT_F5, "f5" }, { PT_F10, "f10" }, { PT_F11, "f11" }, |
| 1669 | { PT_F12, "f12" }, { PT_F13, "f13" }, { PT_F14, "f14" }, |
| 1670 | { PT_F15, "f15" }, { PT_F16, "f16" }, { PT_F17, "f17" }, |
| 1671 | { PT_F18, "f18" }, { PT_F19, "f19" }, { PT_F20, "f20" }, |
| 1672 | { PT_F21, "f21" }, { PT_F22, "f22" }, { PT_F23, "f23" }, |
| 1673 | { PT_F24, "f24" }, { PT_F25, "f25" }, { PT_F26, "f26" }, |
| 1674 | { PT_F27, "f27" }, { PT_F28, "f28" }, { PT_F29, "f29" }, |
| 1675 | { PT_F30, "f30" }, { PT_F31, "f31" }, { PT_R4, "r4" }, |
| 1676 | { PT_R5, "r5" }, { PT_R6, "r6" }, { PT_R7, "r7" }, |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 1677 | { PT_B1, "b1" }, { PT_B2, "b2" }, { PT_B3, "b3" }, |
| 1678 | { PT_B4, "b4" }, { PT_B5, "b5" }, |
Roland McGrath | ca4e10c | 2004-01-13 10:13:20 +0000 | [diff] [blame] | 1679 | { PT_AR_EC, "ar.ec" }, { PT_AR_LC, "ar.lc" }, |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 1680 | /* pt_regs */ |
Roland McGrath | ca4e10c | 2004-01-13 10:13:20 +0000 | [diff] [blame] | 1681 | { PT_CR_IPSR, "psr" }, { PT_CR_IIP, "ip" }, |
| 1682 | { PT_CFM, "cfm" }, { PT_AR_UNAT, "ar.unat" }, |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 1683 | { PT_AR_PFS, "ar.pfs" }, { PT_AR_RSC, "ar.rsc" }, |
| 1684 | { PT_AR_RNAT, "ar.rnat" }, { PT_AR_BSPSTORE, "ar.bspstore" }, |
| 1685 | { PT_PR, "pr" }, { PT_B6, "b6" }, { PT_AR_BSP, "ar.bsp" }, |
| 1686 | { PT_R1, "r1" }, { PT_R2, "r2" }, { PT_R3, "r3" }, |
| 1687 | { PT_R12, "r12" }, { PT_R13, "r13" }, { PT_R14, "r14" }, |
| 1688 | { PT_R15, "r15" }, { PT_R8, "r8" }, { PT_R9, "r9" }, |
| 1689 | { PT_R10, "r10" }, { PT_R11, "r11" }, { PT_R16, "r16" }, |
| 1690 | { PT_R17, "r17" }, { PT_R18, "r18" }, { PT_R19, "r19" }, |
| 1691 | { PT_R20, "r20" }, { PT_R21, "r21" }, { PT_R22, "r22" }, |
| 1692 | { PT_R23, "r23" }, { PT_R24, "r24" }, { PT_R25, "r25" }, |
| 1693 | { PT_R26, "r26" }, { PT_R27, "r27" }, { PT_R28, "r28" }, |
| 1694 | { PT_R29, "r29" }, { PT_R30, "r30" }, { PT_R31, "r31" }, |
| 1695 | { PT_AR_CCV, "ar.ccv" }, { PT_AR_FPSR, "ar.fpsr" }, |
| 1696 | { PT_B0, "b0" }, { PT_B7, "b7" }, { PT_F6, "f6" }, |
| 1697 | { PT_F7, "f7" }, { PT_F8, "f8" }, { PT_F9, "f9" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1698 | # ifdef PT_AR_CSD |
Roland McGrath | fb1bc07 | 2004-03-01 21:29:24 +0000 | [diff] [blame] | 1699 | { PT_AR_CSD, "ar.csd" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1700 | # endif |
| 1701 | # ifdef PT_AR_SSD |
Roland McGrath | fb1bc07 | 2004-03-01 21:29:24 +0000 | [diff] [blame] | 1702 | { PT_AR_SSD, "ar.ssd" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1703 | # endif |
Roland McGrath | ca4e10c | 2004-01-13 10:13:20 +0000 | [diff] [blame] | 1704 | { PT_DBR, "dbr" }, { PT_IBR, "ibr" }, { PT_PMD, "pmd" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1705 | #elif defined(I386) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1706 | { 4*EBX, "4*EBX" }, |
| 1707 | { 4*ECX, "4*ECX" }, |
| 1708 | { 4*EDX, "4*EDX" }, |
| 1709 | { 4*ESI, "4*ESI" }, |
| 1710 | { 4*EDI, "4*EDI" }, |
| 1711 | { 4*EBP, "4*EBP" }, |
| 1712 | { 4*EAX, "4*EAX" }, |
| 1713 | { 4*DS, "4*DS" }, |
| 1714 | { 4*ES, "4*ES" }, |
| 1715 | { 4*FS, "4*FS" }, |
| 1716 | { 4*GS, "4*GS" }, |
| 1717 | { 4*ORIG_EAX, "4*ORIG_EAX" }, |
| 1718 | { 4*EIP, "4*EIP" }, |
| 1719 | { 4*CS, "4*CS" }, |
| 1720 | { 4*EFL, "4*EFL" }, |
| 1721 | { 4*UESP, "4*UESP" }, |
| 1722 | { 4*SS, "4*SS" }, |
H.J. Lu | 35be581 | 2012-04-16 13:00:01 +0200 | [diff] [blame] | 1723 | #elif defined(X86_64) || defined(X32) |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1724 | { 8*R15, "8*R15" }, |
| 1725 | { 8*R14, "8*R14" }, |
| 1726 | { 8*R13, "8*R13" }, |
| 1727 | { 8*R12, "8*R12" }, |
Michal Ludvig | 0e03550 | 2002-09-23 15:41:01 +0000 | [diff] [blame] | 1728 | { 8*RBP, "8*RBP" }, |
Roland McGrath | a4f9f2d | 2005-06-07 23:21:20 +0000 | [diff] [blame] | 1729 | { 8*RBX, "8*RBX" }, |
| 1730 | { 8*R11, "8*R11" }, |
| 1731 | { 8*R10, "8*R10" }, |
| 1732 | { 8*R9, "8*R9" }, |
| 1733 | { 8*R8, "8*R8" }, |
Michal Ludvig | 0e03550 | 2002-09-23 15:41:01 +0000 | [diff] [blame] | 1734 | { 8*RAX, "8*RAX" }, |
Roland McGrath | a4f9f2d | 2005-06-07 23:21:20 +0000 | [diff] [blame] | 1735 | { 8*RCX, "8*RCX" }, |
| 1736 | { 8*RDX, "8*RDX" }, |
| 1737 | { 8*RSI, "8*RSI" }, |
| 1738 | { 8*RDI, "8*RDI" }, |
Roland McGrath | a4f9f2d | 2005-06-07 23:21:20 +0000 | [diff] [blame] | 1739 | { 8*ORIG_RAX, "8*ORIG_RAX" }, |
Michal Ludvig | 0e03550 | 2002-09-23 15:41:01 +0000 | [diff] [blame] | 1740 | { 8*RIP, "8*RIP" }, |
| 1741 | { 8*CS, "8*CS" }, |
| 1742 | { 8*EFLAGS, "8*EFL" }, |
Roland McGrath | a4f9f2d | 2005-06-07 23:21:20 +0000 | [diff] [blame] | 1743 | { 8*RSP, "8*RSP" }, |
Michal Ludvig | 0e03550 | 2002-09-23 15:41:01 +0000 | [diff] [blame] | 1744 | { 8*SS, "8*SS" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1745 | #elif defined(M68K) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1746 | { 4*PT_D1, "4*PT_D1" }, |
| 1747 | { 4*PT_D2, "4*PT_D2" }, |
| 1748 | { 4*PT_D3, "4*PT_D3" }, |
| 1749 | { 4*PT_D4, "4*PT_D4" }, |
| 1750 | { 4*PT_D5, "4*PT_D5" }, |
| 1751 | { 4*PT_D6, "4*PT_D6" }, |
| 1752 | { 4*PT_D7, "4*PT_D7" }, |
| 1753 | { 4*PT_A0, "4*PT_A0" }, |
| 1754 | { 4*PT_A1, "4*PT_A1" }, |
| 1755 | { 4*PT_A2, "4*PT_A2" }, |
| 1756 | { 4*PT_A3, "4*PT_A3" }, |
| 1757 | { 4*PT_A4, "4*PT_A4" }, |
| 1758 | { 4*PT_A5, "4*PT_A5" }, |
| 1759 | { 4*PT_A6, "4*PT_A6" }, |
| 1760 | { 4*PT_D0, "4*PT_D0" }, |
| 1761 | { 4*PT_USP, "4*PT_USP" }, |
| 1762 | { 4*PT_ORIG_D0, "4*PT_ORIG_D0" }, |
| 1763 | { 4*PT_SR, "4*PT_SR" }, |
| 1764 | { 4*PT_PC, "4*PT_PC" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1765 | #elif defined(SH) |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1766 | { 4*REG_REG0, "4*REG_REG0" }, |
| 1767 | { 4*(REG_REG0+1), "4*REG_REG1" }, |
| 1768 | { 4*(REG_REG0+2), "4*REG_REG2" }, |
| 1769 | { 4*(REG_REG0+3), "4*REG_REG3" }, |
| 1770 | { 4*(REG_REG0+4), "4*REG_REG4" }, |
| 1771 | { 4*(REG_REG0+5), "4*REG_REG5" }, |
| 1772 | { 4*(REG_REG0+6), "4*REG_REG6" }, |
| 1773 | { 4*(REG_REG0+7), "4*REG_REG7" }, |
| 1774 | { 4*(REG_REG0+8), "4*REG_REG8" }, |
| 1775 | { 4*(REG_REG0+9), "4*REG_REG9" }, |
| 1776 | { 4*(REG_REG0+10), "4*REG_REG10" }, |
| 1777 | { 4*(REG_REG0+11), "4*REG_REG11" }, |
| 1778 | { 4*(REG_REG0+12), "4*REG_REG12" }, |
| 1779 | { 4*(REG_REG0+13), "4*REG_REG13" }, |
| 1780 | { 4*(REG_REG0+14), "4*REG_REG14" }, |
| 1781 | { 4*REG_REG15, "4*REG_REG15" }, |
| 1782 | { 4*REG_PC, "4*REG_PC" }, |
| 1783 | { 4*REG_PR, "4*REG_PR" }, |
| 1784 | { 4*REG_SR, "4*REG_SR" }, |
| 1785 | { 4*REG_GBR, "4*REG_GBR" }, |
| 1786 | { 4*REG_MACH, "4*REG_MACH" }, |
| 1787 | { 4*REG_MACL, "4*REG_MACL" }, |
| 1788 | { 4*REG_SYSCALL, "4*REG_SYSCALL" }, |
| 1789 | { 4*REG_FPUL, "4*REG_FPUL" }, |
| 1790 | { 4*REG_FPREG0, "4*REG_FPREG0" }, |
| 1791 | { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, |
| 1792 | { 4*(REG_FPREG0+2), "4*REG_FPREG2" }, |
| 1793 | { 4*(REG_FPREG0+3), "4*REG_FPREG3" }, |
| 1794 | { 4*(REG_FPREG0+4), "4*REG_FPREG4" }, |
| 1795 | { 4*(REG_FPREG0+5), "4*REG_FPREG5" }, |
| 1796 | { 4*(REG_FPREG0+6), "4*REG_FPREG6" }, |
| 1797 | { 4*(REG_FPREG0+7), "4*REG_FPREG7" }, |
| 1798 | { 4*(REG_FPREG0+8), "4*REG_FPREG8" }, |
| 1799 | { 4*(REG_FPREG0+9), "4*REG_FPREG9" }, |
| 1800 | { 4*(REG_FPREG0+10), "4*REG_FPREG10" }, |
| 1801 | { 4*(REG_FPREG0+11), "4*REG_FPREG11" }, |
| 1802 | { 4*(REG_FPREG0+12), "4*REG_FPREG12" }, |
| 1803 | { 4*(REG_FPREG0+13), "4*REG_FPREG13" }, |
| 1804 | { 4*(REG_FPREG0+14), "4*REG_FPREG14" }, |
| 1805 | { 4*REG_FPREG15, "4*REG_FPREG15" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1806 | # ifdef REG_XDREG0 |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1807 | { 4*REG_XDREG0, "4*REG_XDREG0" }, |
| 1808 | { 4*(REG_XDREG0+2), "4*REG_XDREG2" }, |
| 1809 | { 4*(REG_XDREG0+4), "4*REG_XDREG4" }, |
| 1810 | { 4*(REG_XDREG0+6), "4*REG_XDREG6" }, |
| 1811 | { 4*(REG_XDREG0+8), "4*REG_XDREG8" }, |
| 1812 | { 4*(REG_XDREG0+10), "4*REG_XDREG10" }, |
| 1813 | { 4*(REG_XDREG0+12), "4*REG_XDREG12" }, |
| 1814 | { 4*REG_XDREG14, "4*REG_XDREG14" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1815 | # endif |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1816 | { 4*REG_FPSCR, "4*REG_FPSCR" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1817 | #elif defined(SH64) |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1818 | { 0, "PC(L)" }, |
| 1819 | { 4, "PC(U)" }, |
| 1820 | { 8, "SR(L)" }, |
| 1821 | { 12, "SR(U)" }, |
| 1822 | { 16, "syscall no.(L)" }, |
| 1823 | { 20, "syscall_no.(U)" }, |
| 1824 | { 24, "R0(L)" }, |
| 1825 | { 28, "R0(U)" }, |
| 1826 | { 32, "R1(L)" }, |
| 1827 | { 36, "R1(U)" }, |
| 1828 | { 40, "R2(L)" }, |
| 1829 | { 44, "R2(U)" }, |
| 1830 | { 48, "R3(L)" }, |
| 1831 | { 52, "R3(U)" }, |
| 1832 | { 56, "R4(L)" }, |
| 1833 | { 60, "R4(U)" }, |
| 1834 | { 64, "R5(L)" }, |
| 1835 | { 68, "R5(U)" }, |
| 1836 | { 72, "R6(L)" }, |
| 1837 | { 76, "R6(U)" }, |
| 1838 | { 80, "R7(L)" }, |
| 1839 | { 84, "R7(U)" }, |
| 1840 | { 88, "R8(L)" }, |
| 1841 | { 92, "R8(U)" }, |
| 1842 | { 96, "R9(L)" }, |
| 1843 | { 100, "R9(U)" }, |
| 1844 | { 104, "R10(L)" }, |
| 1845 | { 108, "R10(U)" }, |
| 1846 | { 112, "R11(L)" }, |
| 1847 | { 116, "R11(U)" }, |
| 1848 | { 120, "R12(L)" }, |
| 1849 | { 124, "R12(U)" }, |
| 1850 | { 128, "R13(L)" }, |
| 1851 | { 132, "R13(U)" }, |
| 1852 | { 136, "R14(L)" }, |
| 1853 | { 140, "R14(U)" }, |
| 1854 | { 144, "R15(L)" }, |
| 1855 | { 148, "R15(U)" }, |
| 1856 | { 152, "R16(L)" }, |
| 1857 | { 156, "R16(U)" }, |
| 1858 | { 160, "R17(L)" }, |
| 1859 | { 164, "R17(U)" }, |
| 1860 | { 168, "R18(L)" }, |
| 1861 | { 172, "R18(U)" }, |
| 1862 | { 176, "R19(L)" }, |
| 1863 | { 180, "R19(U)" }, |
| 1864 | { 184, "R20(L)" }, |
| 1865 | { 188, "R20(U)" }, |
| 1866 | { 192, "R21(L)" }, |
| 1867 | { 196, "R21(U)" }, |
| 1868 | { 200, "R22(L)" }, |
| 1869 | { 204, "R22(U)" }, |
| 1870 | { 208, "R23(L)" }, |
| 1871 | { 212, "R23(U)" }, |
| 1872 | { 216, "R24(L)" }, |
| 1873 | { 220, "R24(U)" }, |
| 1874 | { 224, "R25(L)" }, |
| 1875 | { 228, "R25(U)" }, |
| 1876 | { 232, "R26(L)" }, |
| 1877 | { 236, "R26(U)" }, |
| 1878 | { 240, "R27(L)" }, |
| 1879 | { 244, "R27(U)" }, |
| 1880 | { 248, "R28(L)" }, |
| 1881 | { 252, "R28(U)" }, |
| 1882 | { 256, "R29(L)" }, |
| 1883 | { 260, "R29(U)" }, |
| 1884 | { 264, "R30(L)" }, |
| 1885 | { 268, "R30(U)" }, |
| 1886 | { 272, "R31(L)" }, |
| 1887 | { 276, "R31(U)" }, |
| 1888 | { 280, "R32(L)" }, |
| 1889 | { 284, "R32(U)" }, |
| 1890 | { 288, "R33(L)" }, |
| 1891 | { 292, "R33(U)" }, |
| 1892 | { 296, "R34(L)" }, |
| 1893 | { 300, "R34(U)" }, |
| 1894 | { 304, "R35(L)" }, |
| 1895 | { 308, "R35(U)" }, |
| 1896 | { 312, "R36(L)" }, |
| 1897 | { 316, "R36(U)" }, |
| 1898 | { 320, "R37(L)" }, |
| 1899 | { 324, "R37(U)" }, |
| 1900 | { 328, "R38(L)" }, |
| 1901 | { 332, "R38(U)" }, |
| 1902 | { 336, "R39(L)" }, |
| 1903 | { 340, "R39(U)" }, |
| 1904 | { 344, "R40(L)" }, |
| 1905 | { 348, "R40(U)" }, |
| 1906 | { 352, "R41(L)" }, |
| 1907 | { 356, "R41(U)" }, |
| 1908 | { 360, "R42(L)" }, |
| 1909 | { 364, "R42(U)" }, |
| 1910 | { 368, "R43(L)" }, |
| 1911 | { 372, "R43(U)" }, |
| 1912 | { 376, "R44(L)" }, |
| 1913 | { 380, "R44(U)" }, |
| 1914 | { 384, "R45(L)" }, |
| 1915 | { 388, "R45(U)" }, |
| 1916 | { 392, "R46(L)" }, |
| 1917 | { 396, "R46(U)" }, |
| 1918 | { 400, "R47(L)" }, |
| 1919 | { 404, "R47(U)" }, |
| 1920 | { 408, "R48(L)" }, |
| 1921 | { 412, "R48(U)" }, |
| 1922 | { 416, "R49(L)" }, |
| 1923 | { 420, "R49(U)" }, |
| 1924 | { 424, "R50(L)" }, |
| 1925 | { 428, "R50(U)" }, |
| 1926 | { 432, "R51(L)" }, |
| 1927 | { 436, "R51(U)" }, |
| 1928 | { 440, "R52(L)" }, |
| 1929 | { 444, "R52(U)" }, |
| 1930 | { 448, "R53(L)" }, |
| 1931 | { 452, "R53(U)" }, |
| 1932 | { 456, "R54(L)" }, |
| 1933 | { 460, "R54(U)" }, |
| 1934 | { 464, "R55(L)" }, |
| 1935 | { 468, "R55(U)" }, |
| 1936 | { 472, "R56(L)" }, |
| 1937 | { 476, "R56(U)" }, |
| 1938 | { 480, "R57(L)" }, |
| 1939 | { 484, "R57(U)" }, |
| 1940 | { 488, "R58(L)" }, |
| 1941 | { 492, "R58(U)" }, |
| 1942 | { 496, "R59(L)" }, |
| 1943 | { 500, "R59(U)" }, |
| 1944 | { 504, "R60(L)" }, |
| 1945 | { 508, "R60(U)" }, |
| 1946 | { 512, "R61(L)" }, |
| 1947 | { 516, "R61(U)" }, |
| 1948 | { 520, "R62(L)" }, |
| 1949 | { 524, "R62(U)" }, |
| 1950 | { 528, "TR0(L)" }, |
| 1951 | { 532, "TR0(U)" }, |
| 1952 | { 536, "TR1(L)" }, |
| 1953 | { 540, "TR1(U)" }, |
| 1954 | { 544, "TR2(L)" }, |
| 1955 | { 548, "TR2(U)" }, |
| 1956 | { 552, "TR3(L)" }, |
| 1957 | { 556, "TR3(U)" }, |
| 1958 | { 560, "TR4(L)" }, |
| 1959 | { 564, "TR4(U)" }, |
| 1960 | { 568, "TR5(L)" }, |
| 1961 | { 572, "TR5(U)" }, |
| 1962 | { 576, "TR6(L)" }, |
| 1963 | { 580, "TR6(U)" }, |
| 1964 | { 584, "TR7(L)" }, |
| 1965 | { 588, "TR7(U)" }, |
Denys Vlasenko | adedb51 | 2008-12-30 18:47:55 +0000 | [diff] [blame] | 1966 | /* This entry is in case pt_regs contains dregs (depends on |
| 1967 | the kernel build options). */ |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 1968 | { uoff(regs), "offsetof(struct user, regs)" }, |
| 1969 | { uoff(fpu), "offsetof(struct user, fpu)" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1970 | #elif defined(ARM) |
Roland McGrath | 0f87c49 | 2003-06-03 23:29:04 +0000 | [diff] [blame] | 1971 | { uoff(regs.ARM_r0), "r0" }, |
| 1972 | { uoff(regs.ARM_r1), "r1" }, |
| 1973 | { uoff(regs.ARM_r2), "r2" }, |
| 1974 | { uoff(regs.ARM_r3), "r3" }, |
| 1975 | { uoff(regs.ARM_r4), "r4" }, |
| 1976 | { uoff(regs.ARM_r5), "r5" }, |
| 1977 | { uoff(regs.ARM_r6), "r6" }, |
| 1978 | { uoff(regs.ARM_r7), "r7" }, |
| 1979 | { uoff(regs.ARM_r8), "r8" }, |
| 1980 | { uoff(regs.ARM_r9), "r9" }, |
| 1981 | { uoff(regs.ARM_r10), "r10" }, |
| 1982 | { uoff(regs.ARM_fp), "fp" }, |
| 1983 | { uoff(regs.ARM_ip), "ip" }, |
| 1984 | { uoff(regs.ARM_sp), "sp" }, |
| 1985 | { uoff(regs.ARM_lr), "lr" }, |
| 1986 | { uoff(regs.ARM_pc), "pc" }, |
| 1987 | { uoff(regs.ARM_cpsr), "cpsr" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 1988 | #elif defined(AVR32) |
Denys Vlasenko | 5ae2b7c | 2009-02-27 20:32:52 +0000 | [diff] [blame] | 1989 | { uoff(regs.sr), "sr" }, |
| 1990 | { uoff(regs.pc), "pc" }, |
| 1991 | { uoff(regs.lr), "lr" }, |
| 1992 | { uoff(regs.sp), "sp" }, |
| 1993 | { uoff(regs.r12), "r12" }, |
| 1994 | { uoff(regs.r11), "r11" }, |
| 1995 | { uoff(regs.r10), "r10" }, |
| 1996 | { uoff(regs.r9), "r9" }, |
| 1997 | { uoff(regs.r8), "r8" }, |
| 1998 | { uoff(regs.r7), "r7" }, |
| 1999 | { uoff(regs.r6), "r6" }, |
| 2000 | { uoff(regs.r5), "r5" }, |
| 2001 | { uoff(regs.r4), "r4" }, |
| 2002 | { uoff(regs.r3), "r3" }, |
| 2003 | { uoff(regs.r2), "r2" }, |
| 2004 | { uoff(regs.r1), "r1" }, |
| 2005 | { uoff(regs.r0), "r0" }, |
| 2006 | { uoff(regs.r12_orig), "orig_r12" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2007 | #elif defined(MIPS) |
Roland McGrath | 542c2c6 | 2008-05-20 01:11:56 +0000 | [diff] [blame] | 2008 | { 0, "r0" }, |
| 2009 | { 1, "r1" }, |
| 2010 | { 2, "r2" }, |
| 2011 | { 3, "r3" }, |
| 2012 | { 4, "r4" }, |
| 2013 | { 5, "r5" }, |
| 2014 | { 6, "r6" }, |
| 2015 | { 7, "r7" }, |
| 2016 | { 8, "r8" }, |
| 2017 | { 9, "r9" }, |
| 2018 | { 10, "r10" }, |
| 2019 | { 11, "r11" }, |
| 2020 | { 12, "r12" }, |
| 2021 | { 13, "r13" }, |
| 2022 | { 14, "r14" }, |
| 2023 | { 15, "r15" }, |
| 2024 | { 16, "r16" }, |
| 2025 | { 17, "r17" }, |
| 2026 | { 18, "r18" }, |
| 2027 | { 19, "r19" }, |
| 2028 | { 20, "r20" }, |
| 2029 | { 21, "r21" }, |
| 2030 | { 22, "r22" }, |
| 2031 | { 23, "r23" }, |
| 2032 | { 24, "r24" }, |
| 2033 | { 25, "r25" }, |
| 2034 | { 26, "r26" }, |
| 2035 | { 27, "r27" }, |
| 2036 | { 28, "r28" }, |
| 2037 | { 29, "r29" }, |
| 2038 | { 30, "r30" }, |
| 2039 | { 31, "r31" }, |
| 2040 | { 32, "f0" }, |
| 2041 | { 33, "f1" }, |
| 2042 | { 34, "f2" }, |
| 2043 | { 35, "f3" }, |
| 2044 | { 36, "f4" }, |
| 2045 | { 37, "f5" }, |
| 2046 | { 38, "f6" }, |
| 2047 | { 39, "f7" }, |
| 2048 | { 40, "f8" }, |
| 2049 | { 41, "f9" }, |
| 2050 | { 42, "f10" }, |
| 2051 | { 43, "f11" }, |
| 2052 | { 44, "f12" }, |
| 2053 | { 45, "f13" }, |
| 2054 | { 46, "f14" }, |
| 2055 | { 47, "f15" }, |
| 2056 | { 48, "f16" }, |
| 2057 | { 49, "f17" }, |
| 2058 | { 50, "f18" }, |
| 2059 | { 51, "f19" }, |
| 2060 | { 52, "f20" }, |
| 2061 | { 53, "f21" }, |
| 2062 | { 54, "f22" }, |
| 2063 | { 55, "f23" }, |
| 2064 | { 56, "f24" }, |
| 2065 | { 57, "f25" }, |
| 2066 | { 58, "f26" }, |
| 2067 | { 59, "f27" }, |
| 2068 | { 60, "f28" }, |
| 2069 | { 61, "f29" }, |
| 2070 | { 62, "f30" }, |
| 2071 | { 63, "f31" }, |
| 2072 | { 64, "pc" }, |
| 2073 | { 65, "cause" }, |
| 2074 | { 66, "badvaddr" }, |
| 2075 | { 67, "mmhi" }, |
| 2076 | { 68, "mmlo" }, |
| 2077 | { 69, "fpcsr" }, |
| 2078 | { 70, "fpeir" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2079 | #elif defined(TILE) |
Chris Metcalf | c8c6698 | 2009-12-28 10:00:15 -0500 | [diff] [blame] | 2080 | { PTREGS_OFFSET_REG(0), "r0" }, |
| 2081 | { PTREGS_OFFSET_REG(1), "r1" }, |
| 2082 | { PTREGS_OFFSET_REG(2), "r2" }, |
| 2083 | { PTREGS_OFFSET_REG(3), "r3" }, |
| 2084 | { PTREGS_OFFSET_REG(4), "r4" }, |
| 2085 | { PTREGS_OFFSET_REG(5), "r5" }, |
| 2086 | { PTREGS_OFFSET_REG(6), "r6" }, |
| 2087 | { PTREGS_OFFSET_REG(7), "r7" }, |
| 2088 | { PTREGS_OFFSET_REG(8), "r8" }, |
| 2089 | { PTREGS_OFFSET_REG(9), "r9" }, |
| 2090 | { PTREGS_OFFSET_REG(10), "r10" }, |
| 2091 | { PTREGS_OFFSET_REG(11), "r11" }, |
| 2092 | { PTREGS_OFFSET_REG(12), "r12" }, |
| 2093 | { PTREGS_OFFSET_REG(13), "r13" }, |
| 2094 | { PTREGS_OFFSET_REG(14), "r14" }, |
| 2095 | { PTREGS_OFFSET_REG(15), "r15" }, |
| 2096 | { PTREGS_OFFSET_REG(16), "r16" }, |
| 2097 | { PTREGS_OFFSET_REG(17), "r17" }, |
| 2098 | { PTREGS_OFFSET_REG(18), "r18" }, |
| 2099 | { PTREGS_OFFSET_REG(19), "r19" }, |
| 2100 | { PTREGS_OFFSET_REG(20), "r20" }, |
| 2101 | { PTREGS_OFFSET_REG(21), "r21" }, |
| 2102 | { PTREGS_OFFSET_REG(22), "r22" }, |
| 2103 | { PTREGS_OFFSET_REG(23), "r23" }, |
| 2104 | { PTREGS_OFFSET_REG(24), "r24" }, |
| 2105 | { PTREGS_OFFSET_REG(25), "r25" }, |
| 2106 | { PTREGS_OFFSET_REG(26), "r26" }, |
| 2107 | { PTREGS_OFFSET_REG(27), "r27" }, |
| 2108 | { PTREGS_OFFSET_REG(28), "r28" }, |
| 2109 | { PTREGS_OFFSET_REG(29), "r29" }, |
| 2110 | { PTREGS_OFFSET_REG(30), "r30" }, |
| 2111 | { PTREGS_OFFSET_REG(31), "r31" }, |
| 2112 | { PTREGS_OFFSET_REG(32), "r32" }, |
| 2113 | { PTREGS_OFFSET_REG(33), "r33" }, |
| 2114 | { PTREGS_OFFSET_REG(34), "r34" }, |
| 2115 | { PTREGS_OFFSET_REG(35), "r35" }, |
| 2116 | { PTREGS_OFFSET_REG(36), "r36" }, |
| 2117 | { PTREGS_OFFSET_REG(37), "r37" }, |
| 2118 | { PTREGS_OFFSET_REG(38), "r38" }, |
| 2119 | { PTREGS_OFFSET_REG(39), "r39" }, |
| 2120 | { PTREGS_OFFSET_REG(40), "r40" }, |
| 2121 | { PTREGS_OFFSET_REG(41), "r41" }, |
| 2122 | { PTREGS_OFFSET_REG(42), "r42" }, |
| 2123 | { PTREGS_OFFSET_REG(43), "r43" }, |
| 2124 | { PTREGS_OFFSET_REG(44), "r44" }, |
| 2125 | { PTREGS_OFFSET_REG(45), "r45" }, |
| 2126 | { PTREGS_OFFSET_REG(46), "r46" }, |
| 2127 | { PTREGS_OFFSET_REG(47), "r47" }, |
| 2128 | { PTREGS_OFFSET_REG(48), "r48" }, |
| 2129 | { PTREGS_OFFSET_REG(49), "r49" }, |
| 2130 | { PTREGS_OFFSET_REG(50), "r50" }, |
| 2131 | { PTREGS_OFFSET_REG(51), "r51" }, |
| 2132 | { PTREGS_OFFSET_REG(52), "r52" }, |
| 2133 | { PTREGS_OFFSET_TP, "tp" }, |
| 2134 | { PTREGS_OFFSET_SP, "sp" }, |
| 2135 | { PTREGS_OFFSET_LR, "lr" }, |
| 2136 | { PTREGS_OFFSET_PC, "pc" }, |
| 2137 | { PTREGS_OFFSET_EX1, "ex1" }, |
| 2138 | { PTREGS_OFFSET_FAULTNUM, "faultnum" }, |
| 2139 | { PTREGS_OFFSET_ORIG_R0, "orig_r0" }, |
| 2140 | { PTREGS_OFFSET_FLAGS, "flags" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2141 | #endif |
| 2142 | #ifdef CRISV10 |
Denys Vlasenko | ea0e6e8 | 2009-02-25 17:08:40 +0000 | [diff] [blame] | 2143 | { 4*PT_FRAMETYPE, "4*PT_FRAMETYPE" }, |
| 2144 | { 4*PT_ORIG_R10, "4*PT_ORIG_R10" }, |
| 2145 | { 4*PT_R13, "4*PT_R13" }, |
| 2146 | { 4*PT_R12, "4*PT_R12" }, |
| 2147 | { 4*PT_R11, "4*PT_R11" }, |
| 2148 | { 4*PT_R10, "4*PT_R10" }, |
| 2149 | { 4*PT_R9, "4*PT_R9" }, |
| 2150 | { 4*PT_R8, "4*PT_R8" }, |
| 2151 | { 4*PT_R7, "4*PT_R7" }, |
| 2152 | { 4*PT_R6, "4*PT_R6" }, |
| 2153 | { 4*PT_R5, "4*PT_R5" }, |
| 2154 | { 4*PT_R4, "4*PT_R4" }, |
| 2155 | { 4*PT_R3, "4*PT_R3" }, |
| 2156 | { 4*PT_R2, "4*PT_R2" }, |
| 2157 | { 4*PT_R1, "4*PT_R1" }, |
| 2158 | { 4*PT_R0, "4*PT_R0" }, |
| 2159 | { 4*PT_MOF, "4*PT_MOF" }, |
| 2160 | { 4*PT_DCCR, "4*PT_DCCR" }, |
| 2161 | { 4*PT_SRP, "4*PT_SRP" }, |
| 2162 | { 4*PT_IRP, "4*PT_IRP" }, |
| 2163 | { 4*PT_CSRINSTR, "4*PT_CSRINSTR" }, |
| 2164 | { 4*PT_CSRADDR, "4*PT_CSRADDR" }, |
| 2165 | { 4*PT_CSRDATA, "4*PT_CSRDATA" }, |
| 2166 | { 4*PT_USP, "4*PT_USP" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2167 | #endif |
| 2168 | #ifdef CRISV32 |
Denys Vlasenko | ea0e6e8 | 2009-02-25 17:08:40 +0000 | [diff] [blame] | 2169 | { 4*PT_ORIG_R10, "4*PT_ORIG_R10" }, |
| 2170 | { 4*PT_R0, "4*PT_R0" }, |
| 2171 | { 4*PT_R1, "4*PT_R1" }, |
| 2172 | { 4*PT_R2, "4*PT_R2" }, |
| 2173 | { 4*PT_R3, "4*PT_R3" }, |
| 2174 | { 4*PT_R4, "4*PT_R4" }, |
| 2175 | { 4*PT_R5, "4*PT_R5" }, |
| 2176 | { 4*PT_R6, "4*PT_R6" }, |
| 2177 | { 4*PT_R7, "4*PT_R7" }, |
| 2178 | { 4*PT_R8, "4*PT_R8" }, |
| 2179 | { 4*PT_R9, "4*PT_R9" }, |
| 2180 | { 4*PT_R10, "4*PT_R10" }, |
| 2181 | { 4*PT_R11, "4*PT_R11" }, |
| 2182 | { 4*PT_R12, "4*PT_R12" }, |
| 2183 | { 4*PT_R13, "4*PT_R13" }, |
| 2184 | { 4*PT_ACR, "4*PT_ACR" }, |
| 2185 | { 4*PT_SRS, "4*PT_SRS" }, |
| 2186 | { 4*PT_MOF, "4*PT_MOF" }, |
| 2187 | { 4*PT_SPC, "4*PT_SPC" }, |
| 2188 | { 4*PT_CCS, "4*PT_CCS" }, |
| 2189 | { 4*PT_SRP, "4*PT_SRP" }, |
| 2190 | { 4*PT_ERP, "4*PT_ERP" }, |
| 2191 | { 4*PT_EXS, "4*PT_EXS" }, |
| 2192 | { 4*PT_EDA, "4*PT_EDA" }, |
| 2193 | { 4*PT_USP, "4*PT_USP" }, |
| 2194 | { 4*PT_PPC, "4*PT_PPC" }, |
| 2195 | { 4*PT_BP_CTRL, "4*PT_BP_CTRL" }, |
| 2196 | { 4*PT_BP+4, "4*PT_BP+4" }, |
| 2197 | { 4*PT_BP+8, "4*PT_BP+8" }, |
| 2198 | { 4*PT_BP+12, "4*PT_BP+12" }, |
| 2199 | { 4*PT_BP+16, "4*PT_BP+16" }, |
| 2200 | { 4*PT_BP+20, "4*PT_BP+20" }, |
| 2201 | { 4*PT_BP+24, "4*PT_BP+24" }, |
| 2202 | { 4*PT_BP+28, "4*PT_BP+28" }, |
| 2203 | { 4*PT_BP+32, "4*PT_BP+32" }, |
| 2204 | { 4*PT_BP+36, "4*PT_BP+36" }, |
| 2205 | { 4*PT_BP+40, "4*PT_BP+40" }, |
| 2206 | { 4*PT_BP+44, "4*PT_BP+44" }, |
| 2207 | { 4*PT_BP+48, "4*PT_BP+48" }, |
| 2208 | { 4*PT_BP+52, "4*PT_BP+52" }, |
| 2209 | { 4*PT_BP+56, "4*PT_BP+56" }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2210 | #endif |
| 2211 | #ifdef MICROBLAZE |
Edgar E. Iglesias | 939caba | 2010-07-06 14:21:07 +0200 | [diff] [blame] | 2212 | { PT_GPR(0), "r0" }, |
| 2213 | { PT_GPR(1), "r1" }, |
| 2214 | { PT_GPR(2), "r2" }, |
| 2215 | { PT_GPR(3), "r3" }, |
| 2216 | { PT_GPR(4), "r4" }, |
| 2217 | { PT_GPR(5), "r5" }, |
| 2218 | { PT_GPR(6), "r6" }, |
| 2219 | { PT_GPR(7), "r7" }, |
| 2220 | { PT_GPR(8), "r8" }, |
| 2221 | { PT_GPR(9), "r9" }, |
| 2222 | { PT_GPR(10), "r10" }, |
| 2223 | { PT_GPR(11), "r11" }, |
| 2224 | { PT_GPR(12), "r12" }, |
| 2225 | { PT_GPR(13), "r13" }, |
| 2226 | { PT_GPR(14), "r14" }, |
| 2227 | { PT_GPR(15), "r15" }, |
| 2228 | { PT_GPR(16), "r16" }, |
| 2229 | { PT_GPR(17), "r17" }, |
| 2230 | { PT_GPR(18), "r18" }, |
| 2231 | { PT_GPR(19), "r19" }, |
| 2232 | { PT_GPR(20), "r20" }, |
| 2233 | { PT_GPR(21), "r21" }, |
| 2234 | { PT_GPR(22), "r22" }, |
| 2235 | { PT_GPR(23), "r23" }, |
| 2236 | { PT_GPR(24), "r24" }, |
| 2237 | { PT_GPR(25), "r25" }, |
| 2238 | { PT_GPR(26), "r26" }, |
| 2239 | { PT_GPR(27), "r27" }, |
| 2240 | { PT_GPR(28), "r28" }, |
| 2241 | { PT_GPR(29), "r29" }, |
| 2242 | { PT_GPR(30), "r30" }, |
| 2243 | { PT_GPR(31), "r31" }, |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 2244 | { PT_PC, "rpc", }, |
| 2245 | { PT_MSR, "rmsr", }, |
Edgar E. Iglesias | 939caba | 2010-07-06 14:21:07 +0200 | [diff] [blame] | 2246 | { PT_EAR, "rear", }, |
| 2247 | { PT_ESR, "resr", }, |
| 2248 | { PT_FSR, "rfsr", }, |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 2249 | { PT_KERNEL_MODE, "kernel_mode", }, |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2250 | #endif |
Christian Svensson | 492f81f | 2013-02-14 13:26:27 +0100 | [diff] [blame] | 2251 | #ifdef OR1K |
| 2252 | { 4*0, "r0" }, |
| 2253 | { 4*1, "r1" }, |
| 2254 | { 4*2, "r2" }, |
| 2255 | { 4*3, "r3" }, |
| 2256 | { 4*4, "r4" }, |
| 2257 | { 4*5, "r5" }, |
| 2258 | { 4*6, "r6" }, |
| 2259 | { 4*7, "r7" }, |
| 2260 | { 4*8, "r8" }, |
| 2261 | { 4*9, "r9" }, |
| 2262 | { 4*10, "r10" }, |
| 2263 | { 4*11, "r11" }, |
| 2264 | { 4*12, "r12" }, |
| 2265 | { 4*13, "r13" }, |
| 2266 | { 4*14, "r14" }, |
| 2267 | { 4*15, "r15" }, |
| 2268 | { 4*16, "r16" }, |
| 2269 | { 4*17, "r17" }, |
| 2270 | { 4*18, "r18" }, |
| 2271 | { 4*19, "r19" }, |
| 2272 | { 4*20, "r20" }, |
| 2273 | { 4*21, "r21" }, |
| 2274 | { 4*22, "r22" }, |
| 2275 | { 4*23, "r23" }, |
| 2276 | { 4*24, "r24" }, |
| 2277 | { 4*25, "r25" }, |
| 2278 | { 4*26, "r26" }, |
| 2279 | { 4*27, "r27" }, |
| 2280 | { 4*28, "r28" }, |
| 2281 | { 4*29, "r29" }, |
| 2282 | { 4*30, "r30" }, |
| 2283 | { 4*31, "r31" }, |
| 2284 | { 4*32, "pc" }, |
| 2285 | { 4*33, "sr" }, |
| 2286 | #endif |
Chris Zankel | 8f636ed | 2013-03-25 10:22:07 -0700 | [diff] [blame] | 2287 | #ifdef XTENSA |
| 2288 | { SYSCALL_NR, "syscall_nr" }, |
| 2289 | { REG_AR_BASE, "ar0" }, |
| 2290 | { REG_AR_BASE+1, "ar1" }, |
| 2291 | { REG_AR_BASE+2, "ar2" }, |
| 2292 | { REG_AR_BASE+3, "ar3" }, |
| 2293 | { REG_AR_BASE+4, "ar4" }, |
| 2294 | { REG_AR_BASE+5, "ar5" }, |
| 2295 | { REG_AR_BASE+6, "ar6" }, |
| 2296 | { REG_AR_BASE+7, "ar7" }, |
| 2297 | { REG_AR_BASE+8, "ar8" }, |
| 2298 | { REG_AR_BASE+9, "ar9" }, |
| 2299 | { REG_AR_BASE+10, "ar10" }, |
| 2300 | { REG_AR_BASE+11, "ar11" }, |
| 2301 | { REG_AR_BASE+12, "ar12" }, |
| 2302 | { REG_AR_BASE+13, "ar13" }, |
| 2303 | { REG_AR_BASE+14, "ar14" }, |
| 2304 | { REG_AR_BASE+15, "ar15" }, |
| 2305 | { REG_AR_BASE+16, "ar16" }, |
| 2306 | { REG_AR_BASE+17, "ar17" }, |
| 2307 | { REG_AR_BASE+18, "ar18" }, |
| 2308 | { REG_AR_BASE+19, "ar19" }, |
| 2309 | { REG_AR_BASE+20, "ar20" }, |
| 2310 | { REG_AR_BASE+21, "ar21" }, |
| 2311 | { REG_AR_BASE+22, "ar22" }, |
| 2312 | { REG_AR_BASE+23, "ar23" }, |
| 2313 | { REG_AR_BASE+24, "ar24" }, |
| 2314 | { REG_AR_BASE+25, "ar25" }, |
| 2315 | { REG_AR_BASE+26, "ar26" }, |
| 2316 | { REG_AR_BASE+27, "ar27" }, |
| 2317 | { REG_AR_BASE+28, "ar28" }, |
| 2318 | { REG_AR_BASE+29, "ar29" }, |
| 2319 | { REG_AR_BASE+30, "ar30" }, |
| 2320 | { REG_AR_BASE+31, "ar31" }, |
| 2321 | { REG_AR_BASE+32, "ar32" }, |
| 2322 | { REG_AR_BASE+33, "ar33" }, |
| 2323 | { REG_AR_BASE+34, "ar34" }, |
| 2324 | { REG_AR_BASE+35, "ar35" }, |
| 2325 | { REG_AR_BASE+36, "ar36" }, |
| 2326 | { REG_AR_BASE+37, "ar37" }, |
| 2327 | { REG_AR_BASE+38, "ar38" }, |
| 2328 | { REG_AR_BASE+39, "ar39" }, |
| 2329 | { REG_AR_BASE+40, "ar40" }, |
| 2330 | { REG_AR_BASE+41, "ar41" }, |
| 2331 | { REG_AR_BASE+42, "ar42" }, |
| 2332 | { REG_AR_BASE+43, "ar43" }, |
| 2333 | { REG_AR_BASE+44, "ar44" }, |
| 2334 | { REG_AR_BASE+45, "ar45" }, |
| 2335 | { REG_AR_BASE+46, "ar46" }, |
| 2336 | { REG_AR_BASE+47, "ar47" }, |
| 2337 | { REG_AR_BASE+48, "ar48" }, |
| 2338 | { REG_AR_BASE+49, "ar49" }, |
| 2339 | { REG_AR_BASE+50, "ar50" }, |
| 2340 | { REG_AR_BASE+51, "ar51" }, |
| 2341 | { REG_AR_BASE+52, "ar52" }, |
| 2342 | { REG_AR_BASE+53, "ar53" }, |
| 2343 | { REG_AR_BASE+54, "ar54" }, |
| 2344 | { REG_AR_BASE+55, "ar55" }, |
| 2345 | { REG_AR_BASE+56, "ar56" }, |
| 2346 | { REG_AR_BASE+57, "ar57" }, |
| 2347 | { REG_AR_BASE+58, "ar58" }, |
| 2348 | { REG_AR_BASE+59, "ar59" }, |
| 2349 | { REG_AR_BASE+60, "ar60" }, |
| 2350 | { REG_AR_BASE+61, "ar61" }, |
| 2351 | { REG_AR_BASE+62, "ar62" }, |
| 2352 | { REG_AR_BASE+63, "ar63" }, |
| 2353 | { REG_LBEG, "lbeg" }, |
| 2354 | { REG_LEND, "lend" }, |
| 2355 | { REG_LCOUNT, "lcount" }, |
| 2356 | { REG_SAR, "sar" }, |
| 2357 | { REG_WB, "wb" }, |
| 2358 | { REG_WS, "ws" }, |
| 2359 | { REG_PS, "ps" }, |
| 2360 | { REG_PC, "pc" }, |
| 2361 | { REG_A_BASE, "a0" }, |
| 2362 | { REG_A_BASE+1, "a1" }, |
| 2363 | { REG_A_BASE+2, "a2" }, |
| 2364 | { REG_A_BASE+3, "a3" }, |
| 2365 | { REG_A_BASE+4, "a4" }, |
| 2366 | { REG_A_BASE+5, "a5" }, |
| 2367 | { REG_A_BASE+6, "a6" }, |
| 2368 | { REG_A_BASE+7, "a7" }, |
| 2369 | { REG_A_BASE+8, "a8" }, |
| 2370 | { REG_A_BASE+9, "a9" }, |
| 2371 | { REG_A_BASE+10, "a10" }, |
| 2372 | { REG_A_BASE+11, "a11" }, |
| 2373 | { REG_A_BASE+12, "a12" }, |
| 2374 | { REG_A_BASE+13, "a13" }, |
| 2375 | { REG_A_BASE+14, "a14" }, |
| 2376 | { REG_A_BASE+15, "a15" }, |
| 2377 | #endif |
| 2378 | |
Denys Vlasenko | 729e18d | 2013-02-12 15:51:58 +0100 | [diff] [blame] | 2379 | /* Other fields in "struct user" */ |
| 2380 | #if defined(S390) || defined(S390X) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2381 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2382 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2383 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
Denys Vlasenko | 74307a6 | 2013-02-12 17:10:05 +0100 | [diff] [blame] | 2384 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2385 | /* S390[X] has no start_data */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2386 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2387 | { uoff(signal), "offsetof(struct user, signal)" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2388 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2389 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2390 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
Denys Vlasenko | 729e18d | 2013-02-12 15:51:58 +0100 | [diff] [blame] | 2391 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2392 | #elif defined(POWERPC) |
| 2393 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2394 | #elif defined(I386) || defined(X86_64) || defined(X32) |
| 2395 | { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" }, |
| 2396 | { uoff(i387), "offsetof(struct user, i387)" }, |
| 2397 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2398 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2399 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2400 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2401 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2402 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2403 | { uoff(reserved), "offsetof(struct user, reserved)" }, |
| 2404 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2405 | { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" }, |
| 2406 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2407 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2408 | { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" }, |
Denys Vlasenko | 729e18d | 2013-02-12 15:51:58 +0100 | [diff] [blame] | 2409 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2410 | #elif defined(IA64) |
| 2411 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2412 | #elif defined(ARM) |
| 2413 | { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" }, |
| 2414 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2415 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2416 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2417 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2418 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2419 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2420 | { uoff(reserved), "offsetof(struct user, reserved)" }, |
| 2421 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2422 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2423 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
| 2424 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2425 | #elif defined(AARCH64) |
| 2426 | /* nothing */ |
| 2427 | #elif defined(M68K) |
| 2428 | { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" }, |
| 2429 | { uoff(m68kfp), "offsetof(struct user, m68kfp)" }, |
| 2430 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2431 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2432 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2433 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2434 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2435 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2436 | { uoff(reserved), "offsetof(struct user, reserved)" }, |
| 2437 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2438 | { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" }, |
| 2439 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2440 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
| 2441 | { sizeof(struct user), "sizeof(struct user)" }, |
Denys Vlasenko | 873e5a5 | 2013-02-12 17:15:19 +0100 | [diff] [blame] | 2442 | #elif defined(MIPS) || defined(LINUX_MIPSN32) |
Denys Vlasenko | 729e18d | 2013-02-12 15:51:58 +0100 | [diff] [blame] | 2443 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2444 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2445 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2446 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
Denys Vlasenko | 74307a6 | 2013-02-12 17:10:05 +0100 | [diff] [blame] | 2447 | { uoff(start_data), "offsetof(struct user, start_data)" }, |
Denys Vlasenko | 729e18d | 2013-02-12 15:51:58 +0100 | [diff] [blame] | 2448 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2449 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2450 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2451 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2452 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
| 2453 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2454 | #elif defined(ALPHA) |
| 2455 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2456 | #elif defined(SPARC) |
| 2457 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2458 | #elif defined(SPARC64) |
| 2459 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2460 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2461 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2462 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2463 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2464 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
| 2465 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2466 | #elif defined(HPPA) |
| 2467 | /* nothing */ |
Denys Vlasenko | 873e5a5 | 2013-02-12 17:15:19 +0100 | [diff] [blame] | 2468 | #elif defined(SH) || defined(SH64) |
Denys Vlasenko | 729e18d | 2013-02-12 15:51:58 +0100 | [diff] [blame] | 2469 | { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" }, |
| 2470 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2471 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2472 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2473 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2474 | { uoff(start_data), "offsetof(struct user, start_data)" }, |
| 2475 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2476 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2477 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2478 | { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" }, |
| 2479 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2480 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
| 2481 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2482 | #elif defined(CRISV10) || defined(CRISV32) |
| 2483 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2484 | #elif defined(TILE) |
| 2485 | /* nothing */ |
| 2486 | #elif defined(MICROBLAZE) |
| 2487 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2488 | #elif defined(AVR32) |
| 2489 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2490 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2491 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2492 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2493 | { uoff(start_data), "offsetof(struct user, start_data)" }, |
| 2494 | { uoff(start_stack), "offsetof(struct user, start_stack)" }, |
| 2495 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2496 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2497 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2498 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
| 2499 | { sizeof(struct user), "sizeof(struct user)" }, |
| 2500 | #elif defined(BFIN) |
| 2501 | { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, |
| 2502 | { uoff(u_dsize), "offsetof(struct user, u_dsize)" }, |
| 2503 | { uoff(u_ssize), "offsetof(struct user, u_ssize)" }, |
| 2504 | { uoff(start_code), "offsetof(struct user, start_code)" }, |
| 2505 | { uoff(signal), "offsetof(struct user, signal)" }, |
| 2506 | { uoff(u_ar0), "offsetof(struct user, u_ar0)" }, |
| 2507 | { uoff(magic), "offsetof(struct user, magic)" }, |
| 2508 | { uoff(u_comm), "offsetof(struct user, u_comm)" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2509 | { sizeof(struct user), "sizeof(struct user)" }, |
Christian Svensson | 492f81f | 2013-02-14 13:26:27 +0100 | [diff] [blame] | 2510 | #elif defined(OR1K) |
| 2511 | /* nothing */ |
James Hogan | 5f999a8 | 2013-02-22 14:44:10 +0000 | [diff] [blame] | 2512 | #elif defined(METAG) |
| 2513 | /* nothing */ |
Chris Zankel | 8f636ed | 2013-03-25 10:22:07 -0700 | [diff] [blame] | 2514 | #elif defined(XTENSA) |
| 2515 | /* nothing */ |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2516 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2517 | { 0, NULL }, |
| 2518 | }; |
| 2519 | |
| 2520 | int |
Denys Vlasenko | c7e8371 | 2009-02-24 12:59:47 +0000 | [diff] [blame] | 2521 | sys_ptrace(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2522 | { |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 2523 | const struct xlat *x; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2524 | long addr; |
| 2525 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2526 | if (entering(tcp)) { |
Denys Vlasenko | b7a6dae | 2012-03-20 16:48:35 +0100 | [diff] [blame] | 2527 | printxval(ptrace_cmds, tcp->u_arg[0], "PTRACE_???"); |
Roland McGrath | bf621d4 | 2003-01-14 09:46:21 +0000 | [diff] [blame] | 2528 | tprintf(", %lu, ", tcp->u_arg[1]); |
Denys Vlasenko | be99497 | 2013-02-13 16:10:10 +0100 | [diff] [blame] | 2529 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2530 | addr = tcp->u_arg[2]; |
| 2531 | if (tcp->u_arg[0] == PTRACE_PEEKUSER |
Denys Vlasenko | be99497 | 2013-02-13 16:10:10 +0100 | [diff] [blame] | 2532 | || tcp->u_arg[0] == PTRACE_POKEUSER |
| 2533 | ) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2534 | for (x = struct_user_offsets; x->str; x++) { |
| 2535 | if (x->val >= addr) |
| 2536 | break; |
| 2537 | } |
| 2538 | if (!x->str) |
| 2539 | tprintf("%#lx, ", addr); |
| 2540 | else if (x->val > addr && x != struct_user_offsets) { |
| 2541 | x--; |
| 2542 | tprintf("%s + %ld, ", x->str, addr - x->val); |
| 2543 | } |
| 2544 | else |
| 2545 | tprintf("%s, ", x->str); |
Denys Vlasenko | be99497 | 2013-02-13 16:10:10 +0100 | [diff] [blame] | 2546 | } else |
| 2547 | #ifdef PTRACE_GETREGSET |
Dmitry V. Levin | c41808b | 2013-03-18 00:52:29 +0000 | [diff] [blame] | 2548 | if (tcp->u_arg[0] == PTRACE_GETREGSET |
| 2549 | || tcp->u_arg[0] == PTRACE_SETREGSET |
| 2550 | ) { |
| 2551 | printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???"); |
| 2552 | tprints(", "); |
| 2553 | } else |
Denys Vlasenko | be99497 | 2013-02-13 16:10:10 +0100 | [diff] [blame] | 2554 | #endif |
| 2555 | tprintf("%#lx, ", addr); |
| 2556 | |
| 2557 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2558 | switch (tcp->u_arg[0]) { |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2559 | #ifndef IA64 |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2560 | case PTRACE_PEEKDATA: |
| 2561 | case PTRACE_PEEKTEXT: |
| 2562 | case PTRACE_PEEKUSER: |
| 2563 | break; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2564 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2565 | case PTRACE_CONT: |
| 2566 | case PTRACE_SINGLESTEP: |
| 2567 | case PTRACE_SYSCALL: |
| 2568 | case PTRACE_DETACH: |
| 2569 | printsignal(tcp->u_arg[3]); |
| 2570 | break; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2571 | #ifdef PTRACE_SETOPTIONS |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 2572 | case PTRACE_SETOPTIONS: |
| 2573 | printflags(ptrace_setoptions_flags, tcp->u_arg[3], "PTRACE_O_???"); |
| 2574 | break; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2575 | #endif |
| 2576 | #ifdef PTRACE_SETSIGINFO |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 2577 | case PTRACE_SETSIGINFO: { |
Denys Vlasenko | d4d3ede | 2013-02-13 16:31:32 +0100 | [diff] [blame] | 2578 | printsiginfo_at(tcp, tcp->u_arg[3]); |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 2579 | break; |
| 2580 | } |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2581 | #endif |
| 2582 | #ifdef PTRACE_GETSIGINFO |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 2583 | case PTRACE_GETSIGINFO: |
| 2584 | /* Don't print anything, do it at syscall return. */ |
| 2585 | break; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2586 | #endif |
Denys Vlasenko | be99497 | 2013-02-13 16:10:10 +0100 | [diff] [blame] | 2587 | #ifdef PTRACE_GETREGSET |
| 2588 | case PTRACE_GETREGSET: |
| 2589 | break; |
| 2590 | case PTRACE_SETREGSET: |
| 2591 | tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0); |
| 2592 | break; |
| 2593 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2594 | default: |
| 2595 | tprintf("%#lx", tcp->u_arg[3]); |
| 2596 | break; |
| 2597 | } |
| 2598 | } else { |
| 2599 | switch (tcp->u_arg[0]) { |
| 2600 | case PTRACE_PEEKDATA: |
| 2601 | case PTRACE_PEEKTEXT: |
| 2602 | case PTRACE_PEEKUSER: |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2603 | #ifdef IA64 |
Roland McGrath | 1e86806 | 2007-11-19 22:11:45 +0000 | [diff] [blame] | 2604 | return RVAL_HEX; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2605 | #else |
Roland McGrath | eb28535 | 2003-01-14 09:59:00 +0000 | [diff] [blame] | 2606 | printnum(tcp, tcp->u_arg[3], "%#lx"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2607 | break; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2608 | #endif |
| 2609 | #ifdef PTRACE_GETSIGINFO |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 2610 | case PTRACE_GETSIGINFO: { |
Denys Vlasenko | d4d3ede | 2013-02-13 16:31:32 +0100 | [diff] [blame] | 2611 | printsiginfo_at(tcp, tcp->u_arg[3]); |
Denys Vlasenko | f535b54 | 2009-01-13 18:30:55 +0000 | [diff] [blame] | 2612 | break; |
| 2613 | } |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2614 | #endif |
Denys Vlasenko | be99497 | 2013-02-13 16:10:10 +0100 | [diff] [blame] | 2615 | #ifdef PTRACE_GETREGSET |
| 2616 | case PTRACE_GETREGSET: |
| 2617 | tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0); |
| 2618 | break; |
| 2619 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2620 | } |
| 2621 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 2622 | return 0; |
| 2623 | } |
| 2624 | |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2625 | #ifndef FUTEX_CMP_REQUEUE |
| 2626 | # define FUTEX_CMP_REQUEUE 4 |
| 2627 | #endif |
| 2628 | #ifndef FUTEX_WAKE_OP |
| 2629 | # define FUTEX_WAKE_OP 5 |
| 2630 | #endif |
| 2631 | #ifndef FUTEX_LOCK_PI |
| 2632 | # define FUTEX_LOCK_PI 6 |
| 2633 | # define FUTEX_UNLOCK_PI 7 |
| 2634 | # define FUTEX_TRYLOCK_PI 8 |
| 2635 | #endif |
| 2636 | #ifndef FUTEX_WAIT_BITSET |
| 2637 | # define FUTEX_WAIT_BITSET 9 |
| 2638 | #endif |
| 2639 | #ifndef FUTEX_WAKE_BITSET |
| 2640 | # define FUTEX_WAKE_BITSET 10 |
| 2641 | #endif |
| 2642 | #ifndef FUTEX_WAIT_REQUEUE_PI |
| 2643 | # define FUTEX_WAIT_REQUEUE_PI 11 |
| 2644 | #endif |
| 2645 | #ifndef FUTEX_CMP_REQUEUE_PI |
| 2646 | # define FUTEX_CMP_REQUEUE_PI 12 |
| 2647 | #endif |
| 2648 | #ifndef FUTEX_PRIVATE_FLAG |
| 2649 | # define FUTEX_PRIVATE_FLAG 128 |
| 2650 | #endif |
| 2651 | #ifndef FUTEX_CLOCK_REALTIME |
| 2652 | # define FUTEX_CLOCK_REALTIME 256 |
| 2653 | #endif |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 2654 | static const struct xlat futexops[] = { |
Roland McGrath | 51942a9 | 2007-07-05 18:59:11 +0000 | [diff] [blame] | 2655 | { FUTEX_WAIT, "FUTEX_WAIT" }, |
| 2656 | { FUTEX_WAKE, "FUTEX_WAKE" }, |
| 2657 | { FUTEX_FD, "FUTEX_FD" }, |
| 2658 | { FUTEX_REQUEUE, "FUTEX_REQUEUE" }, |
| 2659 | { FUTEX_CMP_REQUEUE, "FUTEX_CMP_REQUEUE" }, |
| 2660 | { FUTEX_WAKE_OP, "FUTEX_WAKE_OP" }, |
| 2661 | { FUTEX_LOCK_PI, "FUTEX_LOCK_PI" }, |
| 2662 | { FUTEX_UNLOCK_PI, "FUTEX_UNLOCK_PI" }, |
| 2663 | { FUTEX_TRYLOCK_PI, "FUTEX_TRYLOCK_PI" }, |
Roland McGrath | 1aeaf74 | 2008-07-18 01:27:39 +0000 | [diff] [blame] | 2664 | { FUTEX_WAIT_BITSET, "FUTEX_WAIT_BITSET" }, |
| 2665 | { FUTEX_WAKE_BITSET, "FUTEX_WAKE_BITSET" }, |
Andreas Schwab | 85f5832 | 2009-08-12 09:54:42 +0200 | [diff] [blame] | 2666 | { FUTEX_WAIT_REQUEUE_PI, "FUTEX_WAIT_REQUEUE_PI" }, |
| 2667 | { FUTEX_CMP_REQUEUE_PI, "FUTEX_CMP_REQUEUE_PI" }, |
Roland McGrath | 51942a9 | 2007-07-05 18:59:11 +0000 | [diff] [blame] | 2668 | { FUTEX_WAIT|FUTEX_PRIVATE_FLAG, "FUTEX_WAIT_PRIVATE" }, |
| 2669 | { FUTEX_WAKE|FUTEX_PRIVATE_FLAG, "FUTEX_WAKE_PRIVATE" }, |
| 2670 | { FUTEX_FD|FUTEX_PRIVATE_FLAG, "FUTEX_FD_PRIVATE" }, |
| 2671 | { FUTEX_REQUEUE|FUTEX_PRIVATE_FLAG, "FUTEX_REQUEUE_PRIVATE" }, |
| 2672 | { FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG, "FUTEX_CMP_REQUEUE_PRIVATE" }, |
| 2673 | { FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG, "FUTEX_WAKE_OP_PRIVATE" }, |
| 2674 | { FUTEX_LOCK_PI|FUTEX_PRIVATE_FLAG, "FUTEX_LOCK_PI_PRIVATE" }, |
| 2675 | { FUTEX_UNLOCK_PI|FUTEX_PRIVATE_FLAG, "FUTEX_UNLOCK_PI_PRIVATE" }, |
| 2676 | { FUTEX_TRYLOCK_PI|FUTEX_PRIVATE_FLAG, "FUTEX_TRYLOCK_PI_PRIVATE" }, |
Roland McGrath | 1aeaf74 | 2008-07-18 01:27:39 +0000 | [diff] [blame] | 2677 | { FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG, "FUTEX_WAIT_BITSET_PRIVATE" }, |
| 2678 | { FUTEX_WAKE_BITSET|FUTEX_PRIVATE_FLAG, "FUTEX_WAKE_BITSET_PRIVATE" }, |
Andreas Schwab | 85f5832 | 2009-08-12 09:54:42 +0200 | [diff] [blame] | 2679 | { FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG, "FUTEX_WAIT_REQUEUE_PI_PRIVATE" }, |
| 2680 | { FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG, "FUTEX_CMP_REQUEUE_PI_PRIVATE" }, |
| 2681 | { FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, "FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME" }, |
| 2682 | { FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG|FUTEX_CLOCK_REALTIME, "FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME" }, |
| 2683 | { FUTEX_WAIT_REQUEUE_PI|FUTEX_CLOCK_REALTIME, "FUTEX_WAIT_REQUEUE_PI|FUTEX_CLOCK_REALTIME" }, |
| 2684 | { FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG|FUTEX_CLOCK_REALTIME, "FUTEX_WAIT_REQUEUE_PI_PRIVATE|FUTEX_CLOCK_REALTIME" }, |
Roland McGrath | 51942a9 | 2007-07-05 18:59:11 +0000 | [diff] [blame] | 2685 | { 0, NULL } |
| 2686 | }; |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2687 | #ifndef FUTEX_OP_SET |
| 2688 | # define FUTEX_OP_SET 0 |
| 2689 | # define FUTEX_OP_ADD 1 |
| 2690 | # define FUTEX_OP_OR 2 |
| 2691 | # define FUTEX_OP_ANDN 3 |
| 2692 | # define FUTEX_OP_XOR 4 |
| 2693 | # define FUTEX_OP_CMP_EQ 0 |
| 2694 | # define FUTEX_OP_CMP_NE 1 |
| 2695 | # define FUTEX_OP_CMP_LT 2 |
| 2696 | # define FUTEX_OP_CMP_LE 3 |
| 2697 | # define FUTEX_OP_CMP_GT 4 |
| 2698 | # define FUTEX_OP_CMP_GE 5 |
| 2699 | #endif |
Roland McGrath | 51942a9 | 2007-07-05 18:59:11 +0000 | [diff] [blame] | 2700 | static const struct xlat futexwakeops[] = { |
| 2701 | { FUTEX_OP_SET, "FUTEX_OP_SET" }, |
| 2702 | { FUTEX_OP_ADD, "FUTEX_OP_ADD" }, |
| 2703 | { FUTEX_OP_OR, "FUTEX_OP_OR" }, |
| 2704 | { FUTEX_OP_ANDN, "FUTEX_OP_ANDN" }, |
| 2705 | { FUTEX_OP_XOR, "FUTEX_OP_XOR" }, |
| 2706 | { 0, NULL } |
| 2707 | }; |
| 2708 | static const struct xlat futexwakecmps[] = { |
| 2709 | { FUTEX_OP_CMP_EQ, "FUTEX_OP_CMP_EQ" }, |
| 2710 | { FUTEX_OP_CMP_NE, "FUTEX_OP_CMP_NE" }, |
| 2711 | { FUTEX_OP_CMP_LT, "FUTEX_OP_CMP_LT" }, |
| 2712 | { FUTEX_OP_CMP_LE, "FUTEX_OP_CMP_LE" }, |
| 2713 | { FUTEX_OP_CMP_GT, "FUTEX_OP_CMP_GT" }, |
| 2714 | { FUTEX_OP_CMP_GE, "FUTEX_OP_CMP_GE" }, |
| 2715 | { 0, NULL } |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2716 | }; |
| 2717 | |
| 2718 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2719 | sys_futex(struct tcb *tcp) |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2720 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2721 | if (entering(tcp)) { |
| 2722 | long int cmd = tcp->u_arg[1] & 127; |
| 2723 | tprintf("%p, ", (void *) tcp->u_arg[0]); |
| 2724 | printxval(futexops, tcp->u_arg[1], "FUTEX_???"); |
| 2725 | tprintf(", %ld", tcp->u_arg[2]); |
| 2726 | if (cmd == FUTEX_WAKE_BITSET) |
| 2727 | tprintf(", %lx", tcp->u_arg[5]); |
| 2728 | else if (cmd == FUTEX_WAIT) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2729 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2730 | printtv(tcp, tcp->u_arg[3]); |
| 2731 | } else if (cmd == FUTEX_WAIT_BITSET) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2732 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2733 | printtv(tcp, tcp->u_arg[3]); |
| 2734 | tprintf(", %lx", tcp->u_arg[5]); |
| 2735 | } else if (cmd == FUTEX_REQUEUE) |
| 2736 | tprintf(", %ld, %p", tcp->u_arg[3], (void *) tcp->u_arg[4]); |
Andreas Schwab | 85f5832 | 2009-08-12 09:54:42 +0200 | [diff] [blame] | 2737 | else if (cmd == FUTEX_CMP_REQUEUE || cmd == FUTEX_CMP_REQUEUE_PI) |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2738 | tprintf(", %ld, %p, %ld", tcp->u_arg[3], (void *) tcp->u_arg[4], tcp->u_arg[5]); |
| 2739 | else if (cmd == FUTEX_WAKE_OP) { |
| 2740 | tprintf(", %ld, %p, {", tcp->u_arg[3], (void *) tcp->u_arg[4]); |
| 2741 | if ((tcp->u_arg[5] >> 28) & 8) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2742 | tprints("FUTEX_OP_OPARG_SHIFT|"); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2743 | printxval(futexwakeops, (tcp->u_arg[5] >> 28) & 0x7, "FUTEX_OP_???"); |
| 2744 | tprintf(", %ld, ", (tcp->u_arg[5] >> 12) & 0xfff); |
| 2745 | if ((tcp->u_arg[5] >> 24) & 8) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2746 | tprints("FUTEX_OP_OPARG_SHIFT|"); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2747 | printxval(futexwakecmps, (tcp->u_arg[5] >> 24) & 0x7, "FUTEX_OP_CMP_???"); |
| 2748 | tprintf(", %ld}", tcp->u_arg[5] & 0xfff); |
Andreas Schwab | 85f5832 | 2009-08-12 09:54:42 +0200 | [diff] [blame] | 2749 | } else if (cmd == FUTEX_WAIT_REQUEUE_PI) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2750 | tprints(", "); |
Andreas Schwab | 85f5832 | 2009-08-12 09:54:42 +0200 | [diff] [blame] | 2751 | printtv(tcp, tcp->u_arg[3]); |
| 2752 | tprintf(", %p", (void *) tcp->u_arg[4]); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2753 | } |
Roland McGrath | 51942a9 | 2007-07-05 18:59:11 +0000 | [diff] [blame] | 2754 | } |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2755 | return 0; |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2756 | } |
| 2757 | |
| 2758 | static void |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2759 | print_affinitylist(struct tcb *tcp, long list, unsigned int len) |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2760 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2761 | int first = 1; |
Dmitry V. Levin | 62e0596 | 2009-11-03 14:38:44 +0000 | [diff] [blame] | 2762 | unsigned long w, min_len; |
| 2763 | |
| 2764 | if (abbrev(tcp) && len / sizeof(w) > max_strlen) |
| 2765 | min_len = len - max_strlen * sizeof(w); |
| 2766 | else |
| 2767 | min_len = 0; |
| 2768 | for (; len >= sizeof(w) && len > min_len; |
| 2769 | len -= sizeof(w), list += sizeof(w)) { |
| 2770 | if (umove(tcp, list, &w) < 0) |
| 2771 | break; |
| 2772 | if (first) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2773 | tprints("{"); |
Dmitry V. Levin | 62e0596 | 2009-11-03 14:38:44 +0000 | [diff] [blame] | 2774 | else |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2775 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2776 | first = 0; |
Dmitry V. Levin | 62e0596 | 2009-11-03 14:38:44 +0000 | [diff] [blame] | 2777 | tprintf("%lx", w); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2778 | } |
Dmitry V. Levin | 62e0596 | 2009-11-03 14:38:44 +0000 | [diff] [blame] | 2779 | if (len) { |
| 2780 | if (first) |
| 2781 | tprintf("%#lx", list); |
| 2782 | else |
| 2783 | tprintf(", %s}", (len >= sizeof(w) && len > min_len ? |
| 2784 | "???" : "...")); |
| 2785 | } else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2786 | tprints(first ? "{}" : "}"); |
Dmitry V. Levin | 62e0596 | 2009-11-03 14:38:44 +0000 | [diff] [blame] | 2787 | } |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2788 | } |
| 2789 | |
| 2790 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2791 | sys_sched_setaffinity(struct tcb *tcp) |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2792 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2793 | if (entering(tcp)) { |
| 2794 | tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); |
| 2795 | print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]); |
| 2796 | } |
| 2797 | return 0; |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2798 | } |
| 2799 | |
| 2800 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2801 | sys_sched_getaffinity(struct tcb *tcp) |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2802 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2803 | if (entering(tcp)) { |
| 2804 | tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); |
| 2805 | } else { |
| 2806 | if (tcp->u_rval == -1) |
| 2807 | tprintf("%#lx", tcp->u_arg[2]); |
| 2808 | else |
| 2809 | print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval); |
| 2810 | } |
| 2811 | return 0; |
Roland McGrath | 5a22347 | 2002-12-15 23:58:26 +0000 | [diff] [blame] | 2812 | } |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2813 | |
Dmitry V. Levin | 1b0bae2 | 2012-03-11 22:32:26 +0000 | [diff] [blame] | 2814 | int |
| 2815 | sys_get_robust_list(struct tcb *tcp) |
| 2816 | { |
| 2817 | if (entering(tcp)) { |
| 2818 | tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); |
| 2819 | } else { |
| 2820 | void *addr; |
| 2821 | size_t len; |
| 2822 | |
| 2823 | if (syserror(tcp) || |
| 2824 | !tcp->u_arg[1] || |
| 2825 | umove(tcp, tcp->u_arg[1], &addr) < 0) { |
| 2826 | tprintf("%#lx, ", tcp->u_arg[1]); |
| 2827 | } else { |
| 2828 | tprintf("[%p], ", addr); |
| 2829 | } |
| 2830 | |
| 2831 | if (syserror(tcp) || |
| 2832 | !tcp->u_arg[2] || |
| 2833 | umove(tcp, tcp->u_arg[2], &len) < 0) { |
| 2834 | tprintf("%#lx", tcp->u_arg[2]); |
| 2835 | } else { |
| 2836 | tprintf("[%lu]", (unsigned long) len); |
| 2837 | } |
| 2838 | } |
| 2839 | return 0; |
| 2840 | } |
| 2841 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 2842 | static const struct xlat schedulers[] = { |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2843 | { SCHED_OTHER, "SCHED_OTHER" }, |
| 2844 | { SCHED_RR, "SCHED_RR" }, |
| 2845 | { SCHED_FIFO, "SCHED_FIFO" }, |
| 2846 | { 0, NULL } |
| 2847 | }; |
| 2848 | |
| 2849 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2850 | sys_sched_getscheduler(struct tcb *tcp) |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2851 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2852 | if (entering(tcp)) { |
| 2853 | tprintf("%d", (int) tcp->u_arg[0]); |
Denys Vlasenko | b237b1b | 2012-02-27 13:56:59 +0100 | [diff] [blame] | 2854 | } else if (!syserror(tcp)) { |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 2855 | tcp->auxstr = xlookup(schedulers, tcp->u_rval); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2856 | if (tcp->auxstr != NULL) |
| 2857 | return RVAL_STR; |
| 2858 | } |
| 2859 | return 0; |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2860 | } |
| 2861 | |
| 2862 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2863 | sys_sched_setscheduler(struct tcb *tcp) |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2864 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2865 | if (entering(tcp)) { |
| 2866 | struct sched_param p; |
| 2867 | tprintf("%d, ", (int) tcp->u_arg[0]); |
| 2868 | printxval(schedulers, tcp->u_arg[1], "SCHED_???"); |
| 2869 | if (umove(tcp, tcp->u_arg[2], &p) < 0) |
| 2870 | tprintf(", %#lx", tcp->u_arg[2]); |
| 2871 | else |
| 2872 | tprintf(", { %d }", p.__sched_priority); |
| 2873 | } |
| 2874 | return 0; |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2875 | } |
| 2876 | |
| 2877 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2878 | sys_sched_getparam(struct tcb *tcp) |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2879 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2880 | if (entering(tcp)) { |
| 2881 | tprintf("%d, ", (int) tcp->u_arg[0]); |
| 2882 | } else { |
| 2883 | struct sched_param p; |
| 2884 | if (umove(tcp, tcp->u_arg[1], &p) < 0) |
| 2885 | tprintf("%#lx", tcp->u_arg[1]); |
| 2886 | else |
| 2887 | tprintf("{ %d }", p.__sched_priority); |
| 2888 | } |
| 2889 | return 0; |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2890 | } |
| 2891 | |
| 2892 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2893 | sys_sched_setparam(struct tcb *tcp) |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2894 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2895 | if (entering(tcp)) { |
| 2896 | struct sched_param p; |
| 2897 | if (umove(tcp, tcp->u_arg[1], &p) < 0) |
| 2898 | tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]); |
| 2899 | else |
| 2900 | tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority); |
| 2901 | } |
| 2902 | return 0; |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2903 | } |
| 2904 | |
| 2905 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2906 | sys_sched_get_priority_min(struct tcb *tcp) |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2907 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2908 | if (entering(tcp)) { |
| 2909 | printxval(schedulers, tcp->u_arg[0], "SCHED_???"); |
| 2910 | } |
| 2911 | return 0; |
Roland McGrath | 279d378 | 2004-03-01 20:27:37 +0000 | [diff] [blame] | 2912 | } |
Roland McGrath | c2d5eb0 | 2005-02-02 04:16:56 +0000 | [diff] [blame] | 2913 | |
Dmitry V. Levin | 1ff463d | 2012-03-11 23:00:11 +0000 | [diff] [blame] | 2914 | int |
| 2915 | sys_sched_rr_get_interval(struct tcb *tcp) |
| 2916 | { |
| 2917 | if (entering(tcp)) { |
| 2918 | tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); |
| 2919 | } else { |
| 2920 | if (syserror(tcp)) |
| 2921 | tprintf("%#lx", tcp->u_arg[1]); |
| 2922 | else |
| 2923 | print_timespec(tcp, tcp->u_arg[1]); |
| 2924 | } |
| 2925 | return 0; |
| 2926 | } |
| 2927 | |
H.J. Lu | 35be581 | 2012-04-16 13:00:01 +0200 | [diff] [blame] | 2928 | #if defined X86_64 || defined X32 |
Denys Vlasenko | 3e3490a | 2012-03-17 01:27:37 +0100 | [diff] [blame] | 2929 | # include <asm/prctl.h> |
Roland McGrath | c2d5eb0 | 2005-02-02 04:16:56 +0000 | [diff] [blame] | 2930 | |
| 2931 | static const struct xlat archvals[] = { |
| 2932 | { ARCH_SET_GS, "ARCH_SET_GS" }, |
| 2933 | { ARCH_SET_FS, "ARCH_SET_FS" }, |
| 2934 | { ARCH_GET_FS, "ARCH_GET_FS" }, |
| 2935 | { ARCH_GET_GS, "ARCH_GET_GS" }, |
| 2936 | { 0, NULL }, |
| 2937 | }; |
| 2938 | |
| 2939 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2940 | sys_arch_prctl(struct tcb *tcp) |
Roland McGrath | c2d5eb0 | 2005-02-02 04:16:56 +0000 | [diff] [blame] | 2941 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2942 | if (entering(tcp)) { |
| 2943 | printxval(archvals, tcp->u_arg[0], "ARCH_???"); |
| 2944 | if (tcp->u_arg[0] == ARCH_SET_GS |
| 2945 | || tcp->u_arg[0] == ARCH_SET_FS |
| 2946 | ) { |
| 2947 | tprintf(", %#lx", tcp->u_arg[1]); |
| 2948 | } |
| 2949 | } else { |
| 2950 | if (tcp->u_arg[0] == ARCH_GET_GS |
| 2951 | || tcp->u_arg[0] == ARCH_GET_FS |
| 2952 | ) { |
| 2953 | long int v; |
| 2954 | if (!syserror(tcp) && umove(tcp, tcp->u_arg[1], &v) != -1) |
| 2955 | tprintf(", [%#lx]", v); |
| 2956 | else |
| 2957 | tprintf(", %#lx", tcp->u_arg[1]); |
| 2958 | } |
Roland McGrath | c2d5eb0 | 2005-02-02 04:16:56 +0000 | [diff] [blame] | 2959 | } |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2960 | return 0; |
Roland McGrath | c2d5eb0 | 2005-02-02 04:16:56 +0000 | [diff] [blame] | 2961 | } |
H.J. Lu | 35be581 | 2012-04-16 13:00:01 +0200 | [diff] [blame] | 2962 | #endif /* X86_64 || X32 */ |
Roland McGrath | c2d5eb0 | 2005-02-02 04:16:56 +0000 | [diff] [blame] | 2963 | |
Roland McGrath | db8319f | 2007-08-02 01:37:55 +0000 | [diff] [blame] | 2964 | int |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 2965 | sys_getcpu(struct tcb *tcp) |
Roland McGrath | db8319f | 2007-08-02 01:37:55 +0000 | [diff] [blame] | 2966 | { |
| 2967 | if (exiting(tcp)) { |
| 2968 | unsigned u; |
| 2969 | if (tcp->u_arg[0] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2970 | tprints("NULL, "); |
Roland McGrath | db8319f | 2007-08-02 01:37:55 +0000 | [diff] [blame] | 2971 | else if (umove(tcp, tcp->u_arg[0], &u) < 0) |
| 2972 | tprintf("%#lx, ", tcp->u_arg[0]); |
| 2973 | else |
| 2974 | tprintf("[%u], ", u); |
| 2975 | if (tcp->u_arg[1] == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 2976 | tprints("NULL, "); |
Roland McGrath | db8319f | 2007-08-02 01:37:55 +0000 | [diff] [blame] | 2977 | else if (umove(tcp, tcp->u_arg[1], &u) < 0) |
| 2978 | tprintf("%#lx, ", tcp->u_arg[1]); |
| 2979 | else |
| 2980 | tprintf("[%u], ", u); |
| 2981 | tprintf("%#lx", tcp->u_arg[2]); |
| 2982 | } |
| 2983 | return 0; |
| 2984 | } |
| 2985 | |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 2986 | int |
| 2987 | sys_process_vm_readv(struct tcb *tcp) |
| 2988 | { |
| 2989 | if (entering(tcp)) { |
| 2990 | /* arg 1: pid */ |
| 2991 | tprintf("%ld, ", tcp->u_arg[0]); |
| 2992 | } else { |
Dmitry V. Levin | 0bfd744 | 2012-03-10 14:03:25 +0000 | [diff] [blame] | 2993 | /* arg 2: local iov */ |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 2994 | if (syserror(tcp)) { |
Dmitry V. Levin | 0bfd744 | 2012-03-10 14:03:25 +0000 | [diff] [blame] | 2995 | tprintf("%#lx", tcp->u_arg[1]); |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 2996 | } else { |
| 2997 | tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1); |
| 2998 | } |
Dmitry V. Levin | 0bfd744 | 2012-03-10 14:03:25 +0000 | [diff] [blame] | 2999 | /* arg 3: local iovcnt */ |
| 3000 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 3001 | /* arg 4: remote iov */ |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 3002 | if (syserror(tcp)) { |
Dmitry V. Levin | 0bfd744 | 2012-03-10 14:03:25 +0000 | [diff] [blame] | 3003 | tprintf("%#lx", tcp->u_arg[3]); |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 3004 | } else { |
| 3005 | tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], 0); |
| 3006 | } |
Dmitry V. Levin | 0bfd744 | 2012-03-10 14:03:25 +0000 | [diff] [blame] | 3007 | /* arg 5: remote iovcnt */ |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 3008 | /* arg 6: flags */ |
Dmitry V. Levin | 0bfd744 | 2012-03-10 14:03:25 +0000 | [diff] [blame] | 3009 | tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]); |
Denys Vlasenko | 3af224c | 2012-01-28 01:46:33 +0100 | [diff] [blame] | 3010 | } |
| 3011 | return 0; |
| 3012 | } |
Dmitry V. Levin | 0395210 | 2012-03-10 14:14:49 +0000 | [diff] [blame] | 3013 | |
| 3014 | int |
| 3015 | sys_process_vm_writev(struct tcb *tcp) |
| 3016 | { |
| 3017 | if (entering(tcp)) { |
| 3018 | /* arg 1: pid */ |
| 3019 | tprintf("%ld, ", tcp->u_arg[0]); |
| 3020 | /* arg 2: local iov */ |
| 3021 | if (syserror(tcp)) |
| 3022 | tprintf("%#lx", tcp->u_arg[1]); |
| 3023 | else |
| 3024 | tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1); |
| 3025 | /* arg 3: local iovcnt */ |
| 3026 | tprintf(", %lu, ", tcp->u_arg[2]); |
| 3027 | /* arg 4: remote iov */ |
| 3028 | if (syserror(tcp)) |
| 3029 | tprintf("%#lx", tcp->u_arg[3]); |
| 3030 | else |
| 3031 | tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], 0); |
| 3032 | /* arg 5: remote iovcnt */ |
| 3033 | /* arg 6: flags */ |
| 3034 | tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]); |
| 3035 | } |
| 3036 | return 0; |
| 3037 | } |