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>
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>
9 * Copyright (c) 2000 PocketPenguins Inc. Linux for Hitachi SuperH
10 * port by Greg Banks <gbanks@pocketpenguins.com>
12 * All rights reserved.
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
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.
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.
41 #include <sys/resource.h>
42 #include <sys/utsname.h>
52 #ifdef HAVE_LINUX_PTRACE_H
53 # undef PTRACE_SYSCALL
54 # ifdef HAVE_STRUCT_IA64_FPREG
55 # define ia64_fpreg XXX_ia64_fpreg
57 # ifdef HAVE_STRUCT_PT_ALL_USER_REGS
58 # define pt_all_user_regs XXX_pt_all_user_regs
60 # ifdef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
61 # define ptrace_peeksiginfo_args XXX_ptrace_peeksiginfo_args
63 # include <linux/ptrace.h>
64 # undef ptrace_peeksiginfo_args
66 # undef pt_all_user_regs
71 # undef PTRACE_GETREGS
72 # define PTRACE_GETREGS PTRACE_GETREGS64
73 # undef PTRACE_SETREGS
74 # define PTRACE_SETREGS PTRACE_SETREGS64
77 #ifdef HAVE_LINUX_FUTEX_H
78 # include <linux/futex.h>
90 # define FUTEX_REQUEUE 3
94 #include <asm/posix_types.h>
96 #define GETGROUPS_T __kernel_gid_t
98 #define GETGROUPS32_T __kernel_gid32_t
101 # include <asm/ptrace_offsets.h>
102 # include <asm/rse.h>
106 # include <sys/prctl.h>
108 #include "xlat/prctl_options.h"
111 unalignctl_string(unsigned int ctl)
113 static char buf[sizeof(int)*2 + 2];
116 #ifdef PR_UNALIGN_NOPRINT
117 case PR_UNALIGN_NOPRINT:
120 #ifdef PR_UNALIGN_SIGBUS
121 case PR_UNALIGN_SIGBUS:
127 sprintf(buf, "%x", ctl);
132 sys_prctl(struct tcb *tcp)
137 printxval(prctl_options, tcp->u_arg[0], "PR_???");
138 switch (tcp->u_arg[0]) {
143 #ifdef PR_SET_PDEATHSIG
144 case PR_SET_PDEATHSIG:
145 tprintf(", %lu", tcp->u_arg[1]);
148 #ifdef PR_GET_PDEATHSIG
149 case PR_GET_PDEATHSIG:
152 #ifdef PR_SET_DUMPABLE
153 case PR_SET_DUMPABLE:
154 tprintf(", %lu", tcp->u_arg[1]);
157 #ifdef PR_GET_DUMPABLE
158 case PR_GET_DUMPABLE:
161 #ifdef PR_SET_UNALIGN
163 tprintf(", %s", unalignctl_string(tcp->u_arg[1]));
166 #ifdef PR_GET_UNALIGN
168 tprintf(", %#lx", tcp->u_arg[1]);
171 #ifdef PR_SET_KEEPCAPS
172 case PR_SET_KEEPCAPS:
173 tprintf(", %lu", tcp->u_arg[1]);
176 #ifdef PR_GET_KEEPCAPS
177 case PR_GET_KEEPCAPS:
181 for (i = 1; i < tcp->s_ent->nargs; i++)
182 tprintf(", %#lx", tcp->u_arg[i]);
186 switch (tcp->u_arg[0]) {
187 #ifdef PR_GET_PDEATHSIG
188 case PR_GET_PDEATHSIG:
189 if (umove(tcp, tcp->u_arg[1], &i) < 0)
190 tprintf(", %#lx", tcp->u_arg[1]);
192 tprintf(", {%u}", i);
195 #ifdef PR_GET_DUMPABLE
196 case PR_GET_DUMPABLE:
197 return RVAL_UDECIMAL;
199 #ifdef PR_GET_UNALIGN
201 if (syserror(tcp) || umove(tcp, tcp->u_arg[1], &i) < 0)
203 tcp->auxstr = unalignctl_string(i);
206 #ifdef PR_GET_KEEPCAPS
207 case PR_GET_KEEPCAPS:
208 return RVAL_UDECIMAL;
216 #endif /* HAVE_PRCTL */
219 sys_sethostname(struct tcb *tcp)
222 printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
223 tprintf(", %lu", tcp->u_arg[1]);
230 sys_gethostname(struct tcb *tcp)
234 tprintf("%#lx", tcp->u_arg[0]);
236 printstr(tcp, tcp->u_arg[0], -1);
237 tprintf(", %lu", tcp->u_arg[1]);
244 sys_setdomainname(struct tcb *tcp)
247 printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
248 tprintf(", %lu", tcp->u_arg[1]);
254 sys_exit(struct tcb *tcp)
257 fprintf(stderr, "_exit returned!\n");
260 /* special case: we stop tracing this process, finish line now */
261 tprintf("%ld) ", tcp->u_arg[0]);
268 /* defines copied from linux/sched.h since we can't include that
269 * ourselves (it conflicts with *lots* of libc includes)
271 #define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
272 #define CLONE_VM 0x00000100 /* set if VM shared between processes */
273 #define CLONE_FS 0x00000200 /* set if fs info shared between processes */
274 #define CLONE_FILES 0x00000400 /* set if open files shared between processes */
275 #define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */
276 #define CLONE_IDLETASK 0x00001000 /* kernel-only flag */
277 #define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
278 #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
279 #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
280 #define CLONE_THREAD 0x00010000 /* Same thread group? */
281 #define CLONE_NEWNS 0x00020000 /* New namespace group? */
282 #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
283 #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
284 #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
285 #define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
286 #define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
287 #define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
288 #define CLONE_STOPPED 0x02000000 /* Start in stopped state */
289 #define CLONE_NEWUTS 0x04000000 /* New utsname group? */
290 #define CLONE_NEWIPC 0x08000000 /* New ipcs */
291 #define CLONE_NEWUSER 0x10000000 /* New user namespace */
292 #define CLONE_NEWPID 0x20000000 /* New pid namespace */
293 #define CLONE_NEWNET 0x40000000 /* New network namespace */
294 #define CLONE_IO 0x80000000 /* Clone io context */
296 #include "xlat/clone_flags.h"
298 #if defined I386 || defined X86_64 || defined X32
299 extern void print_user_desc(struct tcb *, long);
300 #endif /* I386 || X86_64 || X32 */
305 # define ARG_STACKSIZE (tcp->scno == SYS_clone2 ? 2 : -1)
306 # define ARG_PTID (tcp->scno == SYS_clone2 ? 3 : 2)
307 # define ARG_CTID (tcp->scno == SYS_clone2 ? 4 : 3)
308 # define ARG_TLS (tcp->scno == SYS_clone2 ? 5 : 4)
309 #elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
315 #elif defined X86_64 || defined X32
316 /* x86 personality processes have the last two arguments flipped. */
320 # define ARG_CTID ((current_personality != 1) ? 3 : 4)
321 # define ARG_TLS ((current_personality != 1) ? 4 : 3)
322 #elif defined ALPHA || defined TILE || defined OR1K
337 sys_clone(struct tcb *tcp)
340 const char *sep = "|";
341 unsigned long flags = tcp->u_arg[ARG_FLAGS];
342 tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]);
344 if (ARG_STACKSIZE != -1)
345 tprintf("stack_size=%#lx, ",
346 tcp->u_arg[ARG_STACKSIZE]);
349 if (!printflags(clone_flags, flags &~ CSIGNAL, NULL))
351 if ((flags & CSIGNAL) != 0)
352 tprintf("%s%s", sep, signame(flags & CSIGNAL));
353 if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
354 |CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
356 if (flags & CLONE_PARENT_SETTID)
357 tprintf(", parent_tidptr=%#lx", tcp->u_arg[ARG_PTID]);
358 if (flags & CLONE_SETTLS) {
359 #if defined I386 || defined X86_64 || defined X32
361 if (current_personality == 1)
365 print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
370 #endif /* I386 || X86_64 || X32 */
371 tprintf(", tls=%#lx", tcp->u_arg[ARG_TLS]);
373 if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID))
374 tprintf(", child_tidptr=%#lx", tcp->u_arg[ARG_CTID]);
376 /* TODO on syscall entry:
377 * We can clear CLONE_PTRACE here since it is an ancient hack
378 * to allow us to catch children, and we use another hack for that.
379 * But CLONE_PTRACE can conceivably be used by malicious programs
380 * to subvert us. By clearing this bit, we can defend against it:
381 * in untraced execution, CLONE_PTRACE should have no effect.
383 * We can also clear CLONE_UNTRACED, since it allows to start
384 * children outside of our control. At the moment
385 * I'm trying to figure out whether there is a *legitimate*
386 * use of this flag which we should respect.
392 sys_setns(struct tcb *tcp)
395 printfd(tcp, tcp->u_arg[0]);
397 printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
403 sys_unshare(struct tcb *tcp)
406 printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
411 sys_fork(struct tcb *tcp)
414 return RVAL_UDECIMAL;
418 int sys_getuid(struct tcb *tcp)
421 tcp->u_rval = (uid_t) tcp->u_rval;
422 return RVAL_UDECIMAL;
425 int sys_setfsuid(struct tcb *tcp)
428 tprintf("%u", (uid_t) tcp->u_arg[0]);
430 tcp->u_rval = (uid_t) tcp->u_rval;
431 return RVAL_UDECIMAL;
435 sys_setuid(struct tcb *tcp)
438 tprintf("%u", (uid_t) tcp->u_arg[0]);
444 sys_getresuid(struct tcb *tcp)
449 tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
450 tcp->u_arg[1], tcp->u_arg[2]);
452 if (umove(tcp, tcp->u_arg[0], &uid) < 0)
453 tprintf("%#lx, ", tcp->u_arg[0]);
455 tprintf("[%lu], ", (unsigned long) uid);
456 if (umove(tcp, tcp->u_arg[1], &uid) < 0)
457 tprintf("%#lx, ", tcp->u_arg[1]);
459 tprintf("[%lu], ", (unsigned long) uid);
460 if (umove(tcp, tcp->u_arg[2], &uid) < 0)
461 tprintf("%#lx", tcp->u_arg[2]);
463 tprintf("[%lu]", (unsigned long) uid);
470 sys_setreuid(struct tcb *tcp)
473 printuid("", tcp->u_arg[0]);
474 printuid(", ", tcp->u_arg[1]);
480 sys_setresuid(struct tcb *tcp)
483 printuid("", tcp->u_arg[0]);
484 printuid(", ", tcp->u_arg[1]);
485 printuid(", ", tcp->u_arg[2]);
491 sys_setgroups(struct tcb *tcp)
494 unsigned long len, size, start, cur, end, abbrev_end;
499 tprintf("%lu, ", len);
504 start = tcp->u_arg[1];
509 size = len * sizeof(gid);
511 if (!verbose(tcp) || size / sizeof(gid) != len || end < start) {
512 tprintf("%#lx", start);
516 abbrev_end = start + max_strlen * sizeof(gid);
517 if (abbrev_end < start)
523 for (cur = start; cur < end; cur += sizeof(gid)) {
526 if (cur >= abbrev_end) {
530 if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
535 tprintf("%lu", (unsigned long) gid);
539 tprintf(" %#lx", tcp->u_arg[1]);
545 sys_getgroups(struct tcb *tcp)
551 tprintf("%lu, ", len);
553 unsigned long size, start, cur, end, abbrev_end;
562 start = tcp->u_arg[1];
567 if (tcp->u_arg[0] == 0) {
568 tprintf("%#lx", start);
571 size = len * sizeof(gid);
573 if (!verbose(tcp) || tcp->u_arg[0] == 0 ||
574 size / sizeof(gid) != len || end < start) {
575 tprintf("%#lx", start);
579 abbrev_end = start + max_strlen * sizeof(gid);
580 if (abbrev_end < start)
586 for (cur = start; cur < end; cur += sizeof(gid)) {
589 if (cur >= abbrev_end) {
593 if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
598 tprintf("%lu", (unsigned long) gid);
602 tprintf(" %#lx", tcp->u_arg[1]);
608 sys_setgroups32(struct tcb *tcp)
611 unsigned long len, size, start, cur, end, abbrev_end;
616 tprintf("%lu, ", len);
621 start = tcp->u_arg[1];
626 size = len * sizeof(gid);
628 if (!verbose(tcp) || size / sizeof(gid) != len || end < start) {
629 tprintf("%#lx", start);
633 abbrev_end = start + max_strlen * sizeof(gid);
634 if (abbrev_end < start)
640 for (cur = start; cur < end; cur += sizeof(gid)) {
643 if (cur >= abbrev_end) {
647 if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
652 tprintf("%lu", (unsigned long) gid);
656 tprintf(" %#lx", tcp->u_arg[1]);
662 sys_getgroups32(struct tcb *tcp)
668 tprintf("%lu, ", len);
670 unsigned long size, start, cur, end, abbrev_end;
679 start = tcp->u_arg[1];
684 size = len * sizeof(gid);
686 if (!verbose(tcp) || tcp->u_arg[0] == 0 ||
687 size / sizeof(gid) != len || end < start) {
688 tprintf("%#lx", start);
692 abbrev_end = start + max_strlen * sizeof(gid);
693 if (abbrev_end < start)
699 for (cur = start; cur < end; cur += sizeof(gid)) {
702 if (cur >= abbrev_end) {
706 if (umoven(tcp, cur, sizeof(gid), (char *) &gid) < 0) {
711 tprintf("%lu", (unsigned long) gid);
715 tprintf(" %#lx", tcp->u_arg[1]);
721 printargv(struct tcb *tcp, long addr)
726 char data[sizeof(long)];
730 unsigned wordsize = current_wordsize;
733 for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) {
734 if (umoven(tcp, addr, wordsize, cp.data) < 0) {
735 tprintf("%#lx", addr);
743 printstr(tcp, cp.p64, -1);
747 tprintf("%s...", sep);
751 printargc(const char *fmt, struct tcb *tcp, long addr)
756 for (count = 0; umove(tcp, addr, &cp) >= 0 && cp != NULL; count++) {
757 addr += sizeof(char *);
759 tprintf(fmt, count, count == 1 ? "" : "s");
762 #if defined(SPARC) || defined(SPARC64)
764 sys_execv(struct tcb *tcp)
767 printpath(tcp, tcp->u_arg[0]);
769 tprintf(", %#lx", tcp->u_arg[1]);
772 printargv(tcp, tcp->u_arg[1]);
781 sys_execve(struct tcb *tcp)
784 printpath(tcp, tcp->u_arg[0]);
786 tprintf(", %#lx", tcp->u_arg[1]);
789 printargv(tcp, tcp->u_arg[1]);
793 tprintf(", %#lx", tcp->u_arg[2]);
794 else if (abbrev(tcp))
795 printargc(", [/* %d var%s */]", tcp, tcp->u_arg[2]);
798 printargv(tcp, tcp->u_arg[2]);
806 #define __WNOTHREAD 0x20000000
809 #define __WALL 0x40000000
812 #define __WCLONE 0x80000000
815 #include "xlat/wait4_options.h"
817 #if !defined WCOREFLAG && defined WCOREFLG
818 # define WCOREFLAG WCOREFLG
821 # define WCOREFLAG 0x80
824 # define WCOREDUMP(status) ((status) & 0200)
827 # define W_STOPCODE(sig) ((sig) << 8 | 0x7f)
830 # define W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
834 printstatus(int status)
839 * Here is a tricky presentation problem. This solution
840 * is still not entirely satisfactory but since there
841 * are no wait status constructors it will have to do.
843 if (WIFSTOPPED(status)) {
844 tprintf("[{WIFSTOPPED(s) && WSTOPSIG(s) == %s}",
845 signame(WSTOPSIG(status)));
846 status &= ~W_STOPCODE(WSTOPSIG(status));
848 else if (WIFSIGNALED(status)) {
849 tprintf("[{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}",
850 signame(WTERMSIG(status)),
851 WCOREDUMP(status) ? " && WCOREDUMP(s)" : "");
852 status &= ~(W_EXITCODE(0, WTERMSIG(status)) | WCOREFLAG);
854 else if (WIFEXITED(status)) {
855 tprintf("[{WIFEXITED(s) && WEXITSTATUS(s) == %d}",
856 WEXITSTATUS(status));
858 status &= ~W_EXITCODE(WEXITSTATUS(status), 0);
861 tprintf("[%#x]", status);
868 tprintf(" | %#x]", status);
874 printwaitn(struct tcb *tcp, int n, int bitness)
879 /* On Linux, kernel-side pid_t is typedef'ed to int
880 * on all arches. Also, glibc-2.8 truncates wait3 and wait4
881 * pid argument to int on 64bit arches, producing,
882 * for example, wait4(4294967295, ...) instead of -1
883 * in strace. We have to use int here, not long.
885 int pid = tcp->u_arg[0];
886 tprintf("%d, ", pid);
891 else if (syserror(tcp) || tcp->u_rval == 0)
892 tprintf("%#lx", tcp->u_arg[1]);
893 else if (umove(tcp, tcp->u_arg[1], &status) < 0)
899 printflags(wait4_options, tcp->u_arg[2], "W???");
905 else if (tcp->u_rval > 0) {
908 printrusage32(tcp, tcp->u_arg[3]);
911 printrusage(tcp, tcp->u_arg[3]);
914 tprintf("%#lx", tcp->u_arg[3]);
921 sys_waitpid(struct tcb *tcp)
923 return printwaitn(tcp, 3, 0);
927 sys_wait4(struct tcb *tcp)
929 return printwaitn(tcp, 4, 0);
934 sys_osf_wait4(struct tcb *tcp)
936 return printwaitn(tcp, 4, 1);
940 #include "xlat/waitid_types.h"
943 sys_waitid(struct tcb *tcp)
946 printxval(waitid_types, tcp->u_arg[0], "P_???");
947 tprintf(", %ld, ", tcp->u_arg[1]);
951 printsiginfo_at(tcp, tcp->u_arg[2]);
954 printflags(wait4_options, tcp->u_arg[3], "W???");
955 if (tcp->s_ent->nargs > 4) {
960 else if (tcp->u_error)
961 tprintf("%#lx", tcp->u_arg[4]);
963 printrusage(tcp, tcp->u_arg[4]);
970 sys_uname(struct tcb *tcp)
972 struct utsname uname;
975 if (syserror(tcp) || !verbose(tcp))
976 tprintf("%#lx", tcp->u_arg[0]);
977 else if (umove(tcp, tcp->u_arg[0], &uname) < 0)
979 else if (!abbrev(tcp)) {
980 tprintf("{sysname=\"%s\", nodename=\"%s\", ",
981 uname.sysname, uname.nodename);
982 tprintf("release=\"%s\", version=\"%s\", ",
983 uname.release, uname.version);
984 tprintf("machine=\"%s\"", uname.machine);
985 #ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
986 tprintf(", domainname=\"%s\"", uname.domainname);
991 tprintf("{sys=\"%s\", node=\"%s\", ...}",
992 uname.sysname, uname.nodename);
997 #include "xlat/ptrace_cmds.h"
998 #include "xlat/ptrace_setoptions_flags.h"
999 #include "xlat/nt_descriptor_types.h"
1001 #define uoff(member) offsetof(struct user, member)
1003 const struct xlat struct_user_offsets[] = {
1004 #if defined(S390) || defined(S390X)
1005 { PT_PSWMASK, "psw_mask" },
1006 { PT_PSWADDR, "psw_addr" },
1007 { PT_GPR0, "gpr0" },
1008 { PT_GPR1, "gpr1" },
1009 { PT_GPR2, "gpr2" },
1010 { PT_GPR3, "gpr3" },
1011 { PT_GPR4, "gpr4" },
1012 { PT_GPR5, "gpr5" },
1013 { PT_GPR6, "gpr6" },
1014 { PT_GPR7, "gpr7" },
1015 { PT_GPR8, "gpr8" },
1016 { PT_GPR9, "gpr9" },
1017 { PT_GPR10, "gpr10" },
1018 { PT_GPR11, "gpr11" },
1019 { PT_GPR12, "gpr12" },
1020 { PT_GPR13, "gpr13" },
1021 { PT_GPR14, "gpr14" },
1022 { PT_GPR15, "gpr15" },
1023 { PT_ACR0, "acr0" },
1024 { PT_ACR1, "acr1" },
1025 { PT_ACR2, "acr2" },
1026 { PT_ACR3, "acr3" },
1027 { PT_ACR4, "acr4" },
1028 { PT_ACR5, "acr5" },
1029 { PT_ACR6, "acr6" },
1030 { PT_ACR7, "acr7" },
1031 { PT_ACR8, "acr8" },
1032 { PT_ACR9, "acr9" },
1033 { PT_ACR10, "acr10" },
1034 { PT_ACR11, "acr11" },
1035 { PT_ACR12, "acr12" },
1036 { PT_ACR13, "acr13" },
1037 { PT_ACR14, "acr14" },
1038 { PT_ACR15, "acr15" },
1039 { PT_ORIGGPR2, "orig_gpr2" },
1042 { PT_FPR0_HI, "fpr0.hi" },
1043 { PT_FPR0_LO, "fpr0.lo" },
1044 { PT_FPR1_HI, "fpr1.hi" },
1045 { PT_FPR1_LO, "fpr1.lo" },
1046 { PT_FPR2_HI, "fpr2.hi" },
1047 { PT_FPR2_LO, "fpr2.lo" },
1048 { PT_FPR3_HI, "fpr3.hi" },
1049 { PT_FPR3_LO, "fpr3.lo" },
1050 { PT_FPR4_HI, "fpr4.hi" },
1051 { PT_FPR4_LO, "fpr4.lo" },
1052 { PT_FPR5_HI, "fpr5.hi" },
1053 { PT_FPR5_LO, "fpr5.lo" },
1054 { PT_FPR6_HI, "fpr6.hi" },
1055 { PT_FPR6_LO, "fpr6.lo" },
1056 { PT_FPR7_HI, "fpr7.hi" },
1057 { PT_FPR7_LO, "fpr7.lo" },
1058 { PT_FPR8_HI, "fpr8.hi" },
1059 { PT_FPR8_LO, "fpr8.lo" },
1060 { PT_FPR9_HI, "fpr9.hi" },
1061 { PT_FPR9_LO, "fpr9.lo" },
1062 { PT_FPR10_HI, "fpr10.hi" },
1063 { PT_FPR10_LO, "fpr10.lo" },
1064 { PT_FPR11_HI, "fpr11.hi" },
1065 { PT_FPR11_LO, "fpr11.lo" },
1066 { PT_FPR12_HI, "fpr12.hi" },
1067 { PT_FPR12_LO, "fpr12.lo" },
1068 { PT_FPR13_HI, "fpr13.hi" },
1069 { PT_FPR13_LO, "fpr13.lo" },
1070 { PT_FPR14_HI, "fpr14.hi" },
1071 { PT_FPR14_LO, "fpr14.lo" },
1072 { PT_FPR15_HI, "fpr15.hi" },
1073 { PT_FPR15_LO, "fpr15.lo" },
1076 { PT_FPR0, "fpr0" },
1077 { PT_FPR1, "fpr1" },
1078 { PT_FPR2, "fpr2" },
1079 { PT_FPR3, "fpr3" },
1080 { PT_FPR4, "fpr4" },
1081 { PT_FPR5, "fpr5" },
1082 { PT_FPR6, "fpr6" },
1083 { PT_FPR7, "fpr7" },
1084 { PT_FPR8, "fpr8" },
1085 { PT_FPR9, "fpr9" },
1086 { PT_FPR10, "fpr10" },
1087 { PT_FPR11, "fpr11" },
1088 { PT_FPR12, "fpr12" },
1089 { PT_FPR13, "fpr13" },
1090 { PT_FPR14, "fpr14" },
1091 { PT_FPR15, "fpr15" },
1094 { PT_CR_10, "cr10" },
1095 { PT_CR_11, "cr11" },
1096 { PT_IEEE_IP, "ieee_exception_ip" },
1097 #elif defined(SPARC)
1098 /* XXX No support for these offsets yet. */
1100 /* XXX No support for these offsets yet. */
1101 #elif defined(POWERPC)
1103 # define PT_ORIG_R3 34
1105 # define REGSIZE (sizeof(unsigned long))
1106 { REGSIZE*PT_R0, "r0" },
1107 { REGSIZE*PT_R1, "r1" },
1108 { REGSIZE*PT_R2, "r2" },
1109 { REGSIZE*PT_R3, "r3" },
1110 { REGSIZE*PT_R4, "r4" },
1111 { REGSIZE*PT_R5, "r5" },
1112 { REGSIZE*PT_R6, "r6" },
1113 { REGSIZE*PT_R7, "r7" },
1114 { REGSIZE*PT_R8, "r8" },
1115 { REGSIZE*PT_R9, "r9" },
1116 { REGSIZE*PT_R10, "r10" },
1117 { REGSIZE*PT_R11, "r11" },
1118 { REGSIZE*PT_R12, "r12" },
1119 { REGSIZE*PT_R13, "r13" },
1120 { REGSIZE*PT_R14, "r14" },
1121 { REGSIZE*PT_R15, "r15" },
1122 { REGSIZE*PT_R16, "r16" },
1123 { REGSIZE*PT_R17, "r17" },
1124 { REGSIZE*PT_R18, "r18" },
1125 { REGSIZE*PT_R19, "r19" },
1126 { REGSIZE*PT_R20, "r20" },
1127 { REGSIZE*PT_R21, "r21" },
1128 { REGSIZE*PT_R22, "r22" },
1129 { REGSIZE*PT_R23, "r23" },
1130 { REGSIZE*PT_R24, "r24" },
1131 { REGSIZE*PT_R25, "r25" },
1132 { REGSIZE*PT_R26, "r26" },
1133 { REGSIZE*PT_R27, "r27" },
1134 { REGSIZE*PT_R28, "r28" },
1135 { REGSIZE*PT_R29, "r29" },
1136 { REGSIZE*PT_R30, "r30" },
1137 { REGSIZE*PT_R31, "r31" },
1138 { REGSIZE*PT_NIP, "NIP" },
1139 { REGSIZE*PT_MSR, "MSR" },
1140 { REGSIZE*PT_ORIG_R3, "ORIG_R3" },
1141 { REGSIZE*PT_CTR, "CTR" },
1142 { REGSIZE*PT_LNK, "LNK" },
1143 { REGSIZE*PT_XER, "XER" },
1144 { REGSIZE*PT_CCR, "CCR" },
1145 { REGSIZE*PT_FPR0, "FPR0" },
1147 #elif defined(ALPHA)
1214 { PT_F32, "f32" }, { PT_F33, "f33" }, { PT_F34, "f34" },
1215 { PT_F35, "f35" }, { PT_F36, "f36" }, { PT_F37, "f37" },
1216 { PT_F38, "f38" }, { PT_F39, "f39" }, { PT_F40, "f40" },
1217 { PT_F41, "f41" }, { PT_F42, "f42" }, { PT_F43, "f43" },
1218 { PT_F44, "f44" }, { PT_F45, "f45" }, { PT_F46, "f46" },
1219 { PT_F47, "f47" }, { PT_F48, "f48" }, { PT_F49, "f49" },
1220 { PT_F50, "f50" }, { PT_F51, "f51" }, { PT_F52, "f52" },
1221 { PT_F53, "f53" }, { PT_F54, "f54" }, { PT_F55, "f55" },
1222 { PT_F56, "f56" }, { PT_F57, "f57" }, { PT_F58, "f58" },
1223 { PT_F59, "f59" }, { PT_F60, "f60" }, { PT_F61, "f61" },
1224 { PT_F62, "f62" }, { PT_F63, "f63" }, { PT_F64, "f64" },
1225 { PT_F65, "f65" }, { PT_F66, "f66" }, { PT_F67, "f67" },
1226 { PT_F68, "f68" }, { PT_F69, "f69" }, { PT_F70, "f70" },
1227 { PT_F71, "f71" }, { PT_F72, "f72" }, { PT_F73, "f73" },
1228 { PT_F74, "f74" }, { PT_F75, "f75" }, { PT_F76, "f76" },
1229 { PT_F77, "f77" }, { PT_F78, "f78" }, { PT_F79, "f79" },
1230 { PT_F80, "f80" }, { PT_F81, "f81" }, { PT_F82, "f82" },
1231 { PT_F83, "f83" }, { PT_F84, "f84" }, { PT_F85, "f85" },
1232 { PT_F86, "f86" }, { PT_F87, "f87" }, { PT_F88, "f88" },
1233 { PT_F89, "f89" }, { PT_F90, "f90" }, { PT_F91, "f91" },
1234 { PT_F92, "f92" }, { PT_F93, "f93" }, { PT_F94, "f94" },
1235 { PT_F95, "f95" }, { PT_F96, "f96" }, { PT_F97, "f97" },
1236 { PT_F98, "f98" }, { PT_F99, "f99" }, { PT_F100, "f100" },
1237 { PT_F101, "f101" }, { PT_F102, "f102" }, { PT_F103, "f103" },
1238 { PT_F104, "f104" }, { PT_F105, "f105" }, { PT_F106, "f106" },
1239 { PT_F107, "f107" }, { PT_F108, "f108" }, { PT_F109, "f109" },
1240 { PT_F110, "f110" }, { PT_F111, "f111" }, { PT_F112, "f112" },
1241 { PT_F113, "f113" }, { PT_F114, "f114" }, { PT_F115, "f115" },
1242 { PT_F116, "f116" }, { PT_F117, "f117" }, { PT_F118, "f118" },
1243 { PT_F119, "f119" }, { PT_F120, "f120" }, { PT_F121, "f121" },
1244 { PT_F122, "f122" }, { PT_F123, "f123" }, { PT_F124, "f124" },
1245 { PT_F125, "f125" }, { PT_F126, "f126" }, { PT_F127, "f127" },
1247 { PT_F2, "f2" }, { PT_F3, "f3" }, { PT_F4, "f4" },
1248 { PT_F5, "f5" }, { PT_F10, "f10" }, { PT_F11, "f11" },
1249 { PT_F12, "f12" }, { PT_F13, "f13" }, { PT_F14, "f14" },
1250 { PT_F15, "f15" }, { PT_F16, "f16" }, { PT_F17, "f17" },
1251 { PT_F18, "f18" }, { PT_F19, "f19" }, { PT_F20, "f20" },
1252 { PT_F21, "f21" }, { PT_F22, "f22" }, { PT_F23, "f23" },
1253 { PT_F24, "f24" }, { PT_F25, "f25" }, { PT_F26, "f26" },
1254 { PT_F27, "f27" }, { PT_F28, "f28" }, { PT_F29, "f29" },
1255 { PT_F30, "f30" }, { PT_F31, "f31" }, { PT_R4, "r4" },
1256 { PT_R5, "r5" }, { PT_R6, "r6" }, { PT_R7, "r7" },
1257 { PT_B1, "b1" }, { PT_B2, "b2" }, { PT_B3, "b3" },
1258 { PT_B4, "b4" }, { PT_B5, "b5" },
1259 { PT_AR_EC, "ar.ec" }, { PT_AR_LC, "ar.lc" },
1261 { PT_CR_IPSR, "psr" }, { PT_CR_IIP, "ip" },
1262 { PT_CFM, "cfm" }, { PT_AR_UNAT, "ar.unat" },
1263 { PT_AR_PFS, "ar.pfs" }, { PT_AR_RSC, "ar.rsc" },
1264 { PT_AR_RNAT, "ar.rnat" }, { PT_AR_BSPSTORE, "ar.bspstore" },
1265 { PT_PR, "pr" }, { PT_B6, "b6" }, { PT_AR_BSP, "ar.bsp" },
1266 { PT_R1, "r1" }, { PT_R2, "r2" }, { PT_R3, "r3" },
1267 { PT_R12, "r12" }, { PT_R13, "r13" }, { PT_R14, "r14" },
1268 { PT_R15, "r15" }, { PT_R8, "r8" }, { PT_R9, "r9" },
1269 { PT_R10, "r10" }, { PT_R11, "r11" }, { PT_R16, "r16" },
1270 { PT_R17, "r17" }, { PT_R18, "r18" }, { PT_R19, "r19" },
1271 { PT_R20, "r20" }, { PT_R21, "r21" }, { PT_R22, "r22" },
1272 { PT_R23, "r23" }, { PT_R24, "r24" }, { PT_R25, "r25" },
1273 { PT_R26, "r26" }, { PT_R27, "r27" }, { PT_R28, "r28" },
1274 { PT_R29, "r29" }, { PT_R30, "r30" }, { PT_R31, "r31" },
1275 { PT_AR_CCV, "ar.ccv" }, { PT_AR_FPSR, "ar.fpsr" },
1276 { PT_B0, "b0" }, { PT_B7, "b7" }, { PT_F6, "f6" },
1277 { PT_F7, "f7" }, { PT_F8, "f8" }, { PT_F9, "f9" },
1279 { PT_AR_CSD, "ar.csd" },
1282 { PT_AR_SSD, "ar.ssd" },
1284 { PT_DBR, "dbr" }, { PT_IBR, "ibr" }, { PT_PMD, "pmd" },
1303 #elif defined(X86_64) || defined(X32)
1322 { 8*EFLAGS, "8*EFL" },
1347 { 4*(REG_REG0+1), "4*REG_REG1" },
1348 { 4*(REG_REG0+2), "4*REG_REG2" },
1349 { 4*(REG_REG0+3), "4*REG_REG3" },
1350 { 4*(REG_REG0+4), "4*REG_REG4" },
1351 { 4*(REG_REG0+5), "4*REG_REG5" },
1352 { 4*(REG_REG0+6), "4*REG_REG6" },
1353 { 4*(REG_REG0+7), "4*REG_REG7" },
1354 { 4*(REG_REG0+8), "4*REG_REG8" },
1355 { 4*(REG_REG0+9), "4*REG_REG9" },
1356 { 4*(REG_REG0+10), "4*REG_REG10" },
1357 { 4*(REG_REG0+11), "4*REG_REG11" },
1358 { 4*(REG_REG0+12), "4*REG_REG12" },
1359 { 4*(REG_REG0+13), "4*REG_REG13" },
1360 { 4*(REG_REG0+14), "4*REG_REG14" },
1368 XLAT(4*REG_SYSCALL),
1371 { 4*(REG_FPREG0+1), "4*REG_FPREG1" },
1372 { 4*(REG_FPREG0+2), "4*REG_FPREG2" },
1373 { 4*(REG_FPREG0+3), "4*REG_FPREG3" },
1374 { 4*(REG_FPREG0+4), "4*REG_FPREG4" },
1375 { 4*(REG_FPREG0+5), "4*REG_FPREG5" },
1376 { 4*(REG_FPREG0+6), "4*REG_FPREG6" },
1377 { 4*(REG_FPREG0+7), "4*REG_FPREG7" },
1378 { 4*(REG_FPREG0+8), "4*REG_FPREG8" },
1379 { 4*(REG_FPREG0+9), "4*REG_FPREG9" },
1380 { 4*(REG_FPREG0+10), "4*REG_FPREG10" },
1381 { 4*(REG_FPREG0+11), "4*REG_FPREG11" },
1382 { 4*(REG_FPREG0+12), "4*REG_FPREG12" },
1383 { 4*(REG_FPREG0+13), "4*REG_FPREG13" },
1384 { 4*(REG_FPREG0+14), "4*REG_FPREG14" },
1385 XLAT(4*REG_FPREG15),
1388 { 4*(REG_XDREG0+2), "4*REG_XDREG2" },
1389 { 4*(REG_XDREG0+4), "4*REG_XDREG4" },
1390 { 4*(REG_XDREG0+6), "4*REG_XDREG6" },
1391 { 4*(REG_XDREG0+8), "4*REG_XDREG8" },
1392 { 4*(REG_XDREG0+10), "4*REG_XDREG10" },
1393 { 4*(REG_XDREG0+12), "4*REG_XDREG12" },
1394 XLAT(4*REG_XDREG14),
1402 { 16, "syscall no.(L)" },
1403 { 20, "syscall_no.(U)" },
1546 /* This entry is in case pt_regs contains dregs (depends on
1547 the kernel build options). */
1548 { uoff(regs), "offsetof(struct user, regs)" },
1549 { uoff(fpu), "offsetof(struct user, fpu)" },
1551 { uoff(regs.ARM_r0), "r0" },
1552 { uoff(regs.ARM_r1), "r1" },
1553 { uoff(regs.ARM_r2), "r2" },
1554 { uoff(regs.ARM_r3), "r3" },
1555 { uoff(regs.ARM_r4), "r4" },
1556 { uoff(regs.ARM_r5), "r5" },
1557 { uoff(regs.ARM_r6), "r6" },
1558 { uoff(regs.ARM_r7), "r7" },
1559 { uoff(regs.ARM_r8), "r8" },
1560 { uoff(regs.ARM_r9), "r9" },
1561 { uoff(regs.ARM_r10), "r10" },
1562 { uoff(regs.ARM_fp), "fp" },
1563 { uoff(regs.ARM_ip), "ip" },
1564 { uoff(regs.ARM_sp), "sp" },
1565 { uoff(regs.ARM_lr), "lr" },
1566 { uoff(regs.ARM_pc), "pc" },
1567 { uoff(regs.ARM_cpsr), "cpsr" },
1568 #elif defined(AVR32)
1569 { uoff(regs.sr), "sr" },
1570 { uoff(regs.pc), "pc" },
1571 { uoff(regs.lr), "lr" },
1572 { uoff(regs.sp), "sp" },
1573 { uoff(regs.r12), "r12" },
1574 { uoff(regs.r11), "r11" },
1575 { uoff(regs.r10), "r10" },
1576 { uoff(regs.r9), "r9" },
1577 { uoff(regs.r8), "r8" },
1578 { uoff(regs.r7), "r7" },
1579 { uoff(regs.r6), "r6" },
1580 { uoff(regs.r5), "r5" },
1581 { uoff(regs.r4), "r4" },
1582 { uoff(regs.r3), "r3" },
1583 { uoff(regs.r2), "r2" },
1584 { uoff(regs.r1), "r1" },
1585 { uoff(regs.r0), "r0" },
1586 { uoff(regs.r12_orig), "orig_r12" },
1660 { PTREGS_OFFSET_REG(0), "r0" },
1661 { PTREGS_OFFSET_REG(1), "r1" },
1662 { PTREGS_OFFSET_REG(2), "r2" },
1663 { PTREGS_OFFSET_REG(3), "r3" },
1664 { PTREGS_OFFSET_REG(4), "r4" },
1665 { PTREGS_OFFSET_REG(5), "r5" },
1666 { PTREGS_OFFSET_REG(6), "r6" },
1667 { PTREGS_OFFSET_REG(7), "r7" },
1668 { PTREGS_OFFSET_REG(8), "r8" },
1669 { PTREGS_OFFSET_REG(9), "r9" },
1670 { PTREGS_OFFSET_REG(10), "r10" },
1671 { PTREGS_OFFSET_REG(11), "r11" },
1672 { PTREGS_OFFSET_REG(12), "r12" },
1673 { PTREGS_OFFSET_REG(13), "r13" },
1674 { PTREGS_OFFSET_REG(14), "r14" },
1675 { PTREGS_OFFSET_REG(15), "r15" },
1676 { PTREGS_OFFSET_REG(16), "r16" },
1677 { PTREGS_OFFSET_REG(17), "r17" },
1678 { PTREGS_OFFSET_REG(18), "r18" },
1679 { PTREGS_OFFSET_REG(19), "r19" },
1680 { PTREGS_OFFSET_REG(20), "r20" },
1681 { PTREGS_OFFSET_REG(21), "r21" },
1682 { PTREGS_OFFSET_REG(22), "r22" },
1683 { PTREGS_OFFSET_REG(23), "r23" },
1684 { PTREGS_OFFSET_REG(24), "r24" },
1685 { PTREGS_OFFSET_REG(25), "r25" },
1686 { PTREGS_OFFSET_REG(26), "r26" },
1687 { PTREGS_OFFSET_REG(27), "r27" },
1688 { PTREGS_OFFSET_REG(28), "r28" },
1689 { PTREGS_OFFSET_REG(29), "r29" },
1690 { PTREGS_OFFSET_REG(30), "r30" },
1691 { PTREGS_OFFSET_REG(31), "r31" },
1692 { PTREGS_OFFSET_REG(32), "r32" },
1693 { PTREGS_OFFSET_REG(33), "r33" },
1694 { PTREGS_OFFSET_REG(34), "r34" },
1695 { PTREGS_OFFSET_REG(35), "r35" },
1696 { PTREGS_OFFSET_REG(36), "r36" },
1697 { PTREGS_OFFSET_REG(37), "r37" },
1698 { PTREGS_OFFSET_REG(38), "r38" },
1699 { PTREGS_OFFSET_REG(39), "r39" },
1700 { PTREGS_OFFSET_REG(40), "r40" },
1701 { PTREGS_OFFSET_REG(41), "r41" },
1702 { PTREGS_OFFSET_REG(42), "r42" },
1703 { PTREGS_OFFSET_REG(43), "r43" },
1704 { PTREGS_OFFSET_REG(44), "r44" },
1705 { PTREGS_OFFSET_REG(45), "r45" },
1706 { PTREGS_OFFSET_REG(46), "r46" },
1707 { PTREGS_OFFSET_REG(47), "r47" },
1708 { PTREGS_OFFSET_REG(48), "r48" },
1709 { PTREGS_OFFSET_REG(49), "r49" },
1710 { PTREGS_OFFSET_REG(50), "r50" },
1711 { PTREGS_OFFSET_REG(51), "r51" },
1712 { PTREGS_OFFSET_REG(52), "r52" },
1713 { PTREGS_OFFSET_TP, "tp" },
1714 { PTREGS_OFFSET_SP, "sp" },
1715 { PTREGS_OFFSET_LR, "lr" },
1716 { PTREGS_OFFSET_PC, "pc" },
1717 { PTREGS_OFFSET_EX1, "ex1" },
1718 { PTREGS_OFFSET_FAULTNUM, "faultnum" },
1719 { PTREGS_OFFSET_ORIG_R0, "orig_r0" },
1720 { PTREGS_OFFSET_FLAGS, "flags" },
1723 XLAT(4*PT_FRAMETYPE),
1724 XLAT(4*PT_ORIG_R10),
1743 XLAT(4*PT_CSRINSTR),
1749 XLAT(4*PT_ORIG_R10),
1792 { PT_GPR(0), "r0" },
1793 { PT_GPR(1), "r1" },
1794 { PT_GPR(2), "r2" },
1795 { PT_GPR(3), "r3" },
1796 { PT_GPR(4), "r4" },
1797 { PT_GPR(5), "r5" },
1798 { PT_GPR(6), "r6" },
1799 { PT_GPR(7), "r7" },
1800 { PT_GPR(8), "r8" },
1801 { PT_GPR(9), "r9" },
1802 { PT_GPR(10), "r10" },
1803 { PT_GPR(11), "r11" },
1804 { PT_GPR(12), "r12" },
1805 { PT_GPR(13), "r13" },
1806 { PT_GPR(14), "r14" },
1807 { PT_GPR(15), "r15" },
1808 { PT_GPR(16), "r16" },
1809 { PT_GPR(17), "r17" },
1810 { PT_GPR(18), "r18" },
1811 { PT_GPR(19), "r19" },
1812 { PT_GPR(20), "r20" },
1813 { PT_GPR(21), "r21" },
1814 { PT_GPR(22), "r22" },
1815 { PT_GPR(23), "r23" },
1816 { PT_GPR(24), "r24" },
1817 { PT_GPR(25), "r25" },
1818 { PT_GPR(26), "r26" },
1819 { PT_GPR(27), "r27" },
1820 { PT_GPR(28), "r28" },
1821 { PT_GPR(29), "r29" },
1822 { PT_GPR(30), "r30" },
1823 { PT_GPR(31), "r31" },
1825 { PT_MSR, "rmsr", },
1826 { PT_EAR, "rear", },
1827 { PT_ESR, "resr", },
1828 { PT_FSR, "rfsr", },
1829 { PT_KERNEL_MODE, "kernel_mode", },
1868 { REG_A_BASE, "a0" },
1869 { REG_A_BASE+1, "a1" },
1870 { REG_A_BASE+2, "a2" },
1871 { REG_A_BASE+3, "a3" },
1872 { REG_A_BASE+4, "a4" },
1873 { REG_A_BASE+5, "a5" },
1874 { REG_A_BASE+6, "a6" },
1875 { REG_A_BASE+7, "a7" },
1876 { REG_A_BASE+8, "a8" },
1877 { REG_A_BASE+9, "a9" },
1878 { REG_A_BASE+10, "a10" },
1879 { REG_A_BASE+11, "a11" },
1880 { REG_A_BASE+12, "a12" },
1881 { REG_A_BASE+13, "a13" },
1882 { REG_A_BASE+14, "a14" },
1883 { REG_A_BASE+15, "a15" },
1885 { SYSCALL_NR, "syscall_nr" },
1886 { REG_AR_BASE, "ar0" },
1887 { REG_AR_BASE+1, "ar1" },
1888 { REG_AR_BASE+2, "ar2" },
1889 { REG_AR_BASE+3, "ar3" },
1890 { REG_AR_BASE+4, "ar4" },
1891 { REG_AR_BASE+5, "ar5" },
1892 { REG_AR_BASE+6, "ar6" },
1893 { REG_AR_BASE+7, "ar7" },
1894 { REG_AR_BASE+8, "ar8" },
1895 { REG_AR_BASE+9, "ar9" },
1896 { REG_AR_BASE+10, "ar10" },
1897 { REG_AR_BASE+11, "ar11" },
1898 { REG_AR_BASE+12, "ar12" },
1899 { REG_AR_BASE+13, "ar13" },
1900 { REG_AR_BASE+14, "ar14" },
1901 { REG_AR_BASE+15, "ar15" },
1902 { REG_AR_BASE+16, "ar16" },
1903 { REG_AR_BASE+17, "ar17" },
1904 { REG_AR_BASE+18, "ar18" },
1905 { REG_AR_BASE+19, "ar19" },
1906 { REG_AR_BASE+20, "ar20" },
1907 { REG_AR_BASE+21, "ar21" },
1908 { REG_AR_BASE+22, "ar22" },
1909 { REG_AR_BASE+23, "ar23" },
1910 { REG_AR_BASE+24, "ar24" },
1911 { REG_AR_BASE+25, "ar25" },
1912 { REG_AR_BASE+26, "ar26" },
1913 { REG_AR_BASE+27, "ar27" },
1914 { REG_AR_BASE+28, "ar28" },
1915 { REG_AR_BASE+29, "ar29" },
1916 { REG_AR_BASE+30, "ar30" },
1917 { REG_AR_BASE+31, "ar31" },
1918 { REG_AR_BASE+32, "ar32" },
1919 { REG_AR_BASE+33, "ar33" },
1920 { REG_AR_BASE+34, "ar34" },
1921 { REG_AR_BASE+35, "ar35" },
1922 { REG_AR_BASE+36, "ar36" },
1923 { REG_AR_BASE+37, "ar37" },
1924 { REG_AR_BASE+38, "ar38" },
1925 { REG_AR_BASE+39, "ar39" },
1926 { REG_AR_BASE+40, "ar40" },
1927 { REG_AR_BASE+41, "ar41" },
1928 { REG_AR_BASE+42, "ar42" },
1929 { REG_AR_BASE+43, "ar43" },
1930 { REG_AR_BASE+44, "ar44" },
1931 { REG_AR_BASE+45, "ar45" },
1932 { REG_AR_BASE+46, "ar46" },
1933 { REG_AR_BASE+47, "ar47" },
1934 { REG_AR_BASE+48, "ar48" },
1935 { REG_AR_BASE+49, "ar49" },
1936 { REG_AR_BASE+50, "ar50" },
1937 { REG_AR_BASE+51, "ar51" },
1938 { REG_AR_BASE+52, "ar52" },
1939 { REG_AR_BASE+53, "ar53" },
1940 { REG_AR_BASE+54, "ar54" },
1941 { REG_AR_BASE+55, "ar55" },
1942 { REG_AR_BASE+56, "ar56" },
1943 { REG_AR_BASE+57, "ar57" },
1944 { REG_AR_BASE+58, "ar58" },
1945 { REG_AR_BASE+59, "ar59" },
1946 { REG_AR_BASE+60, "ar60" },
1947 { REG_AR_BASE+61, "ar61" },
1948 { REG_AR_BASE+62, "ar62" },
1949 { REG_AR_BASE+63, "ar63" },
1950 { REG_LBEG, "lbeg" },
1951 { REG_LEND, "lend" },
1952 { REG_LCOUNT, "lcount" },
1959 /* Other fields in "struct user" */
1960 #if defined(S390) || defined(S390X)
1961 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1962 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1963 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1964 { uoff(start_code), "offsetof(struct user, start_code)" },
1965 /* S390[X] has no start_data */
1966 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1967 { uoff(signal), "offsetof(struct user, signal)" },
1968 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1969 { uoff(magic), "offsetof(struct user, magic)" },
1970 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1971 { sizeof(struct user), "sizeof(struct user)" },
1972 #elif defined(POWERPC)
1973 { sizeof(struct user), "sizeof(struct user)" },
1974 #elif defined(I386) || defined(X86_64) || defined(X32)
1975 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1976 { uoff(i387), "offsetof(struct user, i387)" },
1977 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1978 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1979 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1980 { uoff(start_code), "offsetof(struct user, start_code)" },
1981 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1982 { uoff(signal), "offsetof(struct user, signal)" },
1983 { uoff(reserved), "offsetof(struct user, reserved)" },
1984 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
1985 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
1986 { uoff(magic), "offsetof(struct user, magic)" },
1987 { uoff(u_comm), "offsetof(struct user, u_comm)" },
1988 { uoff(u_debugreg), "offsetof(struct user, u_debugreg)" },
1989 { sizeof(struct user), "sizeof(struct user)" },
1991 { sizeof(struct user), "sizeof(struct user)" },
1993 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
1994 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
1995 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
1996 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
1997 { uoff(start_code), "offsetof(struct user, start_code)" },
1998 { uoff(start_stack), "offsetof(struct user, start_stack)" },
1999 { uoff(signal), "offsetof(struct user, signal)" },
2000 { uoff(reserved), "offsetof(struct user, reserved)" },
2001 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
2002 { uoff(magic), "offsetof(struct user, magic)" },
2003 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2004 { sizeof(struct user), "sizeof(struct user)" },
2005 #elif defined(AARCH64)
2008 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
2009 { uoff(m68kfp), "offsetof(struct user, m68kfp)" },
2010 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
2011 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
2012 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
2013 { uoff(start_code), "offsetof(struct user, start_code)" },
2014 { uoff(start_stack), "offsetof(struct user, start_stack)" },
2015 { uoff(signal), "offsetof(struct user, signal)" },
2016 { uoff(reserved), "offsetof(struct user, reserved)" },
2017 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
2018 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
2019 { uoff(magic), "offsetof(struct user, magic)" },
2020 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2021 { sizeof(struct user), "sizeof(struct user)" },
2022 #elif defined(MIPS) || defined(LINUX_MIPSN32)
2023 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
2024 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
2025 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
2026 { uoff(start_code), "offsetof(struct user, start_code)" },
2027 { uoff(start_data), "offsetof(struct user, start_data)" },
2028 { uoff(start_stack), "offsetof(struct user, start_stack)" },
2029 { uoff(signal), "offsetof(struct user, signal)" },
2030 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
2031 { uoff(magic), "offsetof(struct user, magic)" },
2032 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2033 { sizeof(struct user), "sizeof(struct user)" },
2034 #elif defined(ALPHA)
2035 { sizeof(struct user), "sizeof(struct user)" },
2036 #elif defined(SPARC)
2037 { sizeof(struct user), "sizeof(struct user)" },
2038 #elif defined(SPARC64)
2039 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
2040 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
2041 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
2042 { uoff(signal), "offsetof(struct user, signal)" },
2043 { uoff(magic), "offsetof(struct user, magic)" },
2044 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2045 { sizeof(struct user), "sizeof(struct user)" },
2048 #elif defined(SH) || defined(SH64)
2049 { uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
2050 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
2051 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
2052 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
2053 { uoff(start_code), "offsetof(struct user, start_code)" },
2054 { uoff(start_data), "offsetof(struct user, start_data)" },
2055 { uoff(start_stack), "offsetof(struct user, start_stack)" },
2056 { uoff(signal), "offsetof(struct user, signal)" },
2057 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
2058 { uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
2059 { uoff(magic), "offsetof(struct user, magic)" },
2060 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2061 { sizeof(struct user), "sizeof(struct user)" },
2062 #elif defined(CRISV10) || defined(CRISV32)
2063 { sizeof(struct user), "sizeof(struct user)" },
2066 #elif defined(MICROBLAZE)
2067 { sizeof(struct user), "sizeof(struct user)" },
2068 #elif defined(AVR32)
2069 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
2070 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
2071 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
2072 { uoff(start_code), "offsetof(struct user, start_code)" },
2073 { uoff(start_data), "offsetof(struct user, start_data)" },
2074 { uoff(start_stack), "offsetof(struct user, start_stack)" },
2075 { uoff(signal), "offsetof(struct user, signal)" },
2076 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
2077 { uoff(magic), "offsetof(struct user, magic)" },
2078 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2079 { sizeof(struct user), "sizeof(struct user)" },
2081 { uoff(u_tsize), "offsetof(struct user, u_tsize)" },
2082 { uoff(u_dsize), "offsetof(struct user, u_dsize)" },
2083 { uoff(u_ssize), "offsetof(struct user, u_ssize)" },
2084 { uoff(start_code), "offsetof(struct user, start_code)" },
2085 { uoff(signal), "offsetof(struct user, signal)" },
2086 { uoff(u_ar0), "offsetof(struct user, u_ar0)" },
2087 { uoff(magic), "offsetof(struct user, magic)" },
2088 { uoff(u_comm), "offsetof(struct user, u_comm)" },
2089 { sizeof(struct user), "sizeof(struct user)" },
2092 #elif defined(METAG)
2094 #elif defined(XTENSA)
2103 sys_ptrace(struct tcb *tcp)
2105 const struct xlat *x;
2108 if (entering(tcp)) {
2109 printxval(ptrace_cmds, tcp->u_arg[0], "PTRACE_???");
2110 tprintf(", %lu, ", tcp->u_arg[1]);
2112 addr = tcp->u_arg[2];
2113 if (tcp->u_arg[0] == PTRACE_PEEKUSER
2114 || tcp->u_arg[0] == PTRACE_POKEUSER
2116 for (x = struct_user_offsets; x->str; x++) {
2121 tprintf("%#lx, ", addr);
2122 else if (x->val > addr && x != struct_user_offsets) {
2124 tprintf("%s + %ld, ", x->str, addr - x->val);
2127 tprintf("%s, ", x->str);
2129 #ifdef PTRACE_GETREGSET
2130 if (tcp->u_arg[0] == PTRACE_GETREGSET
2131 || tcp->u_arg[0] == PTRACE_SETREGSET
2133 printxval(nt_descriptor_types, tcp->u_arg[2], "NT_???");
2137 tprintf("%#lx, ", addr);
2140 switch (tcp->u_arg[0]) {
2142 case PTRACE_PEEKDATA:
2143 case PTRACE_PEEKTEXT:
2144 case PTRACE_PEEKUSER:
2148 case PTRACE_SINGLESTEP:
2149 case PTRACE_SYSCALL:
2151 printsignal(tcp->u_arg[3]);
2153 #ifdef PTRACE_SETOPTIONS
2154 case PTRACE_SETOPTIONS:
2155 printflags(ptrace_setoptions_flags, tcp->u_arg[3], "PTRACE_O_???");
2158 #ifdef PTRACE_SETSIGINFO
2159 case PTRACE_SETSIGINFO: {
2160 printsiginfo_at(tcp, tcp->u_arg[3]);
2164 #ifdef PTRACE_GETSIGINFO
2165 case PTRACE_GETSIGINFO:
2166 /* Don't print anything, do it at syscall return. */
2169 #ifdef PTRACE_GETREGSET
2170 case PTRACE_GETREGSET:
2172 case PTRACE_SETREGSET:
2173 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
2177 tprintf("%#lx", tcp->u_arg[3]);
2181 switch (tcp->u_arg[0]) {
2182 case PTRACE_PEEKDATA:
2183 case PTRACE_PEEKTEXT:
2184 case PTRACE_PEEKUSER:
2188 printnum(tcp, tcp->u_arg[3], "%#lx");
2191 #ifdef PTRACE_GETSIGINFO
2192 case PTRACE_GETSIGINFO: {
2193 printsiginfo_at(tcp, tcp->u_arg[3]);
2197 #ifdef PTRACE_GETREGSET
2198 case PTRACE_GETREGSET:
2199 tprint_iov(tcp, /*len:*/ 1, tcp->u_arg[3], /*as string:*/ 0);
2207 #ifndef FUTEX_CMP_REQUEUE
2208 # define FUTEX_CMP_REQUEUE 4
2210 #ifndef FUTEX_WAKE_OP
2211 # define FUTEX_WAKE_OP 5
2213 #ifndef FUTEX_LOCK_PI
2214 # define FUTEX_LOCK_PI 6
2215 # define FUTEX_UNLOCK_PI 7
2216 # define FUTEX_TRYLOCK_PI 8
2218 #ifndef FUTEX_WAIT_BITSET
2219 # define FUTEX_WAIT_BITSET 9
2221 #ifndef FUTEX_WAKE_BITSET
2222 # define FUTEX_WAKE_BITSET 10
2224 #ifndef FUTEX_WAIT_REQUEUE_PI
2225 # define FUTEX_WAIT_REQUEUE_PI 11
2227 #ifndef FUTEX_CMP_REQUEUE_PI
2228 # define FUTEX_CMP_REQUEUE_PI 12
2230 #ifndef FUTEX_PRIVATE_FLAG
2231 # define FUTEX_PRIVATE_FLAG 128
2233 #ifndef FUTEX_CLOCK_REALTIME
2234 # define FUTEX_CLOCK_REALTIME 256
2236 #ifndef FUTEX_WAIT_PRIVATE
2237 # define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
2239 #ifndef FUTEX_WAKE_PRIVATE
2240 # define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
2242 #ifndef FUTEX_REQUEUE_PRIVATE
2243 # define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG)
2245 #ifndef FUTEX_CMP_REQUEUE_PRIVATE
2246 # define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG)
2248 #ifndef FUTEX_WAKE_OP_PRIVATE
2249 # define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG)
2251 #ifndef FUTEX_LOCK_PI_PRIVATE
2252 # define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
2254 #ifndef FUTEX_UNLOCK_PI_PRIVATE
2255 # define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
2257 #ifndef FUTEX_TRYLOCK_PI_PRIVATE
2258 # define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
2260 #ifndef FUTEX_WAIT_BITSET_PRIVATE
2261 # define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
2263 #ifndef FUTEX_WAKE_BITSET_PRIVATE
2264 # define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
2266 #ifndef FUTEX_WAIT_REQUEUE_PI_PRIVATE
2267 # define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | FUTEX_PRIVATE_FLAG)
2269 #ifndef FUTEX_CMP_REQUEUE_PI_PRIVATE
2270 # define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | FUTEX_PRIVATE_FLAG)
2272 #include "xlat/futexops.h"
2273 #ifndef FUTEX_OP_SET
2274 # define FUTEX_OP_SET 0
2275 # define FUTEX_OP_ADD 1
2276 # define FUTEX_OP_OR 2
2277 # define FUTEX_OP_ANDN 3
2278 # define FUTEX_OP_XOR 4
2279 # define FUTEX_OP_CMP_EQ 0
2280 # define FUTEX_OP_CMP_NE 1
2281 # define FUTEX_OP_CMP_LT 2
2282 # define FUTEX_OP_CMP_LE 3
2283 # define FUTEX_OP_CMP_GT 4
2284 # define FUTEX_OP_CMP_GE 5
2286 #include "xlat/futexwakeops.h"
2287 #include "xlat/futexwakecmps.h"
2290 sys_futex(struct tcb *tcp)
2292 if (entering(tcp)) {
2293 long int cmd = tcp->u_arg[1] & 127;
2294 tprintf("%p, ", (void *) tcp->u_arg[0]);
2295 printxval(futexops, tcp->u_arg[1], "FUTEX_???");
2296 tprintf(", %ld", tcp->u_arg[2]);
2297 if (cmd == FUTEX_WAKE_BITSET)
2298 tprintf(", %lx", tcp->u_arg[5]);
2299 else if (cmd == FUTEX_WAIT) {
2301 printtv(tcp, tcp->u_arg[3]);
2302 } else if (cmd == FUTEX_WAIT_BITSET) {
2304 printtv(tcp, tcp->u_arg[3]);
2305 tprintf(", %lx", tcp->u_arg[5]);
2306 } else if (cmd == FUTEX_REQUEUE)
2307 tprintf(", %ld, %p", tcp->u_arg[3], (void *) tcp->u_arg[4]);
2308 else if (cmd == FUTEX_CMP_REQUEUE || cmd == FUTEX_CMP_REQUEUE_PI)
2309 tprintf(", %ld, %p, %ld", tcp->u_arg[3], (void *) tcp->u_arg[4], tcp->u_arg[5]);
2310 else if (cmd == FUTEX_WAKE_OP) {
2311 tprintf(", %ld, %p, {", tcp->u_arg[3], (void *) tcp->u_arg[4]);
2312 if ((tcp->u_arg[5] >> 28) & 8)
2313 tprints("FUTEX_OP_OPARG_SHIFT|");
2314 printxval(futexwakeops, (tcp->u_arg[5] >> 28) & 0x7, "FUTEX_OP_???");
2315 tprintf(", %ld, ", (tcp->u_arg[5] >> 12) & 0xfff);
2316 if ((tcp->u_arg[5] >> 24) & 8)
2317 tprints("FUTEX_OP_OPARG_SHIFT|");
2318 printxval(futexwakecmps, (tcp->u_arg[5] >> 24) & 0x7, "FUTEX_OP_CMP_???");
2319 tprintf(", %ld}", tcp->u_arg[5] & 0xfff);
2320 } else if (cmd == FUTEX_WAIT_REQUEUE_PI) {
2322 printtv(tcp, tcp->u_arg[3]);
2323 tprintf(", %p", (void *) tcp->u_arg[4]);
2330 print_affinitylist(struct tcb *tcp, long list, unsigned int len)
2333 unsigned long w, min_len;
2335 if (abbrev(tcp) && len / sizeof(w) > max_strlen)
2336 min_len = len - max_strlen * sizeof(w);
2339 for (; len >= sizeof(w) && len > min_len;
2340 len -= sizeof(w), list += sizeof(w)) {
2341 if (umove(tcp, list, &w) < 0)
2352 tprintf("%#lx", list);
2354 tprintf(", %s}", (len >= sizeof(w) && len > min_len ?
2357 tprints(first ? "{}" : "}");
2362 sys_sched_setaffinity(struct tcb *tcp)
2364 if (entering(tcp)) {
2365 tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
2366 print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]);
2372 sys_sched_getaffinity(struct tcb *tcp)
2374 if (entering(tcp)) {
2375 tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
2377 if (tcp->u_rval == -1)
2378 tprintf("%#lx", tcp->u_arg[2]);
2380 print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval);
2386 sys_get_robust_list(struct tcb *tcp)
2388 if (entering(tcp)) {
2389 tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
2394 if (syserror(tcp) ||
2396 umove(tcp, tcp->u_arg[1], &addr) < 0) {
2397 tprintf("%#lx, ", tcp->u_arg[1]);
2399 tprintf("[%p], ", addr);
2402 if (syserror(tcp) ||
2404 umove(tcp, tcp->u_arg[2], &len) < 0) {
2405 tprintf("%#lx", tcp->u_arg[2]);
2407 tprintf("[%lu]", (unsigned long) len);
2413 #include "xlat/schedulers.h"
2416 sys_sched_getscheduler(struct tcb *tcp)
2418 if (entering(tcp)) {
2419 tprintf("%d", (int) tcp->u_arg[0]);
2420 } else if (!syserror(tcp)) {
2421 tcp->auxstr = xlookup(schedulers, tcp->u_rval);
2422 if (tcp->auxstr != NULL)
2429 sys_sched_setscheduler(struct tcb *tcp)
2431 if (entering(tcp)) {
2432 struct sched_param p;
2433 tprintf("%d, ", (int) tcp->u_arg[0]);
2434 printxval(schedulers, tcp->u_arg[1], "SCHED_???");
2435 if (umove(tcp, tcp->u_arg[2], &p) < 0)
2436 tprintf(", %#lx", tcp->u_arg[2]);
2438 tprintf(", { %d }", p.sched_priority);
2444 sys_sched_getparam(struct tcb *tcp)
2446 if (entering(tcp)) {
2447 tprintf("%d, ", (int) tcp->u_arg[0]);
2449 struct sched_param p;
2450 if (umove(tcp, tcp->u_arg[1], &p) < 0)
2451 tprintf("%#lx", tcp->u_arg[1]);
2453 tprintf("{ %d }", p.sched_priority);
2459 sys_sched_setparam(struct tcb *tcp)
2461 if (entering(tcp)) {
2462 struct sched_param p;
2463 if (umove(tcp, tcp->u_arg[1], &p) < 0)
2464 tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]);
2466 tprintf("%d, { %d }", (int) tcp->u_arg[0], p.sched_priority);
2472 sys_sched_get_priority_min(struct tcb *tcp)
2474 if (entering(tcp)) {
2475 printxval(schedulers, tcp->u_arg[0], "SCHED_???");
2481 sys_sched_rr_get_interval(struct tcb *tcp)
2483 if (entering(tcp)) {
2484 tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
2487 tprintf("%#lx", tcp->u_arg[1]);
2489 print_timespec(tcp, tcp->u_arg[1]);
2494 #if defined X86_64 || defined X32
2495 # include <asm/prctl.h>
2497 #include "xlat/archvals.h"
2500 sys_arch_prctl(struct tcb *tcp)
2502 if (entering(tcp)) {
2503 printxval(archvals, tcp->u_arg[0], "ARCH_???");
2504 if (tcp->u_arg[0] == ARCH_SET_GS
2505 || tcp->u_arg[0] == ARCH_SET_FS
2507 tprintf(", %#lx", tcp->u_arg[1]);
2510 if (tcp->u_arg[0] == ARCH_GET_GS
2511 || tcp->u_arg[0] == ARCH_GET_FS
2514 if (!syserror(tcp) && umove(tcp, tcp->u_arg[1], &v) != -1)
2515 tprintf(", [%#lx]", v);
2517 tprintf(", %#lx", tcp->u_arg[1]);
2522 #endif /* X86_64 || X32 */
2525 sys_getcpu(struct tcb *tcp)
2529 if (tcp->u_arg[0] == 0)
2531 else if (umove(tcp, tcp->u_arg[0], &u) < 0)
2532 tprintf("%#lx, ", tcp->u_arg[0]);
2534 tprintf("[%u], ", u);
2535 if (tcp->u_arg[1] == 0)
2537 else if (umove(tcp, tcp->u_arg[1], &u) < 0)
2538 tprintf("%#lx, ", tcp->u_arg[1]);
2540 tprintf("[%u], ", u);
2541 tprintf("%#lx", tcp->u_arg[2]);
2547 sys_process_vm_readv(struct tcb *tcp)
2549 if (entering(tcp)) {
2551 tprintf("%ld, ", tcp->u_arg[0]);
2553 /* arg 2: local iov */
2554 if (syserror(tcp)) {
2555 tprintf("%#lx", tcp->u_arg[1]);
2557 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
2559 /* arg 3: local iovcnt */
2560 tprintf(", %lu, ", tcp->u_arg[2]);
2561 /* arg 4: remote iov */
2562 if (syserror(tcp)) {
2563 tprintf("%#lx", tcp->u_arg[3]);
2565 tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], 0);
2567 /* arg 5: remote iovcnt */
2569 tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]);
2575 sys_process_vm_writev(struct tcb *tcp)
2577 if (entering(tcp)) {
2579 tprintf("%ld, ", tcp->u_arg[0]);
2580 /* arg 2: local iov */
2582 tprintf("%#lx", tcp->u_arg[1]);
2584 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
2585 /* arg 3: local iovcnt */
2586 tprintf(", %lu, ", tcp->u_arg[2]);
2587 /* arg 4: remote iov */
2589 tprintf("%#lx", tcp->u_arg[3]);
2591 tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], 0);
2592 /* arg 5: remote iovcnt */
2594 tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]);