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