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