[PATCH 3/3] avr32: add support for new architecture AVR32
Hans-Christian Egtvedt
hans-christian.egtvedt at atmel.com
Tue Feb 24 13:58:42 UTC 2009
This patch adds AVR32 architecture support to strace. Implemented by
Håvard Skinnemoen (haavard.skinnemoen at atmel.com) and ported to latest
CVS HEAD by Hans-Christian Egtvedt (hans-christian.egtvedt at atmel.com).
Tested on AP7000 with some random commands, and behaves nice. I also
tried going through the test/ directory, but they seem to be a bit
outdated and a bit x86 specific AFAICT?
Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt at atmel.com>
---
Makefile.am | 1 +
configure.ac | 4 +
defs.h | 7 +-
linux/avr32/syscallent.h | 311 ++++++++++++++++++++++++++++++++++++++++++++++
process.c | 57 ++++++++-
syscall.c | 46 +++++++
util.c | 14 ++
7 files changed, 432 insertions(+), 8 deletions(-)
create mode 100644 linux/avr32/syscallent.h
diff --git a/Makefile.am b/Makefile.am
index d1cfe41..de8b170 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,7 @@ EXTRA_DIST = $(man_MANS) errnoent.sh signalent.sh syscallent.sh ioctlsort.c \
linux/arm/syscallent.h linux/arm/syscallent1.h \
linux/arm/signalent1.h linux/arm/ioctlent1.h \
linux/arm/errnoent1.h \
+ linux/avr32/syscallent.h \
linux/bfin/ioctlent.h linux/bfin/syscallent.h \
linux/hppa/errnoent.h linux/hppa/ioctlent.h \
linux/hppa/signalent.h linux/hppa/syscallent.h \
diff --git a/configure.ac b/configure.ac
index fb77788..528023a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,10 @@ x86?64*)
arch=x86_64
AC_DEFINE([X86_64], 1, [Define for the AMD x86-64 architecture.])
;;
+avr32*)
+ arch=avr32
+ AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
+ ;;
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
diff --git a/defs.h b/defs.h
index 0b88d15..e2553e0 100644
--- a/defs.h
+++ b/defs.h
@@ -113,6 +113,9 @@
# if defined(ARM)
# define LINUX_ARM
# endif
+# if defined(AVR32)
+# define LINUX_AVR32
+# endif
#endif
#if defined(SVR4) || defined(FREEBSD)
@@ -139,7 +142,7 @@
#include <sys/pioctl.h>
#endif /* FREEBSD */
#else /* !USE_PROCFS */
-#if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_ARM)) && defined(__GLIBC__)
+#if (defined(LINUXSPARC) || defined(LINUX_X86_64) || defined(LINUX_ARM) || defined (LINUX_AVR32)) && defined(__GLIBC__)
#include <sys/ptrace.h>
#else
/* Work around awkward prototype in ptrace.h. */
@@ -370,7 +373,7 @@ struct tcb {
* without using TCB_WAITEXECVE flag.
* I guess we can remove it from the source somewhere around year 2010 :)
*/
-# if defined(ALPHA) || defined(SPARC) || defined(SPARC64) || defined(POWERPC) || defined(IA64) || defined(HPPA) || defined(SH) || defined(SH64) || defined(S390) || defined(S390X) || defined(ARM) || defined(MIPS) || defined(BFIN)
+# if defined(ALPHA) || defined(AVR32) || defined(SPARC) || defined(SPARC64) || defined(POWERPC) || defined(IA64) || defined(HPPA) || defined(SH) || defined(SH64) || defined(S390) || defined(S390X) || defined(ARM) || defined(MIPS) || defined(BFIN)
# define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */
# endif
# define TCB_CLONE_DETACHED 04000 /* CLONE_DETACHED set in creating syscall */
diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h
new file mode 100644
index 0000000..1bfd68a
--- /dev/null
+++ b/linux/avr32/syscallent.h
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2004-2009 Atmel Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+ { 0, 0, sys_setup, "setup" }, /* 0 */
+ { 1, TP, sys_exit, "_exit" }, /* 1 */
+ { 0, TP, sys_fork, "fork" }, /* 2 */
+ { 3, TD, sys_read, "read" }, /* 3 */
+ { 3, TD, sys_write, "write" }, /* 4 */
+ { 3, TD|TF, sys_open, "open" }, /* 5 */
+ { 1, TD, sys_close, "close" }, /* 6 */
+ { 1, 0, sys_umask, "umask" }, /* 7 */
+ { 2, TD|TF, sys_creat, "creat" }, /* 8 */
+ { 2, TF, sys_link, "link" }, /* 9 */
+ { 1, TF, sys_unlink, "unlink" }, /* 10 */
+ { 3, TF|TP, sys_execve, "execve" }, /* 11 */
+ { 1, TF, sys_chdir, "chdir" }, /* 12 */
+ { 1, 0, sys_time, "time" }, /* 13 */
+ { 3, TF, sys_mknod, "mknod" }, /* 14 */
+ { 2, TF, sys_chmod, "chmod" }, /* 15 */
+ { 3, TF, sys_chown, "chown" }, /* 16 */
+ { 3, TF, sys_chown, "lchown" }, /* 17 */
+ { 3, TD, sys_lseek, "lseek" }, /* 18 */
+ { 5, TD, sys_llseek, "_llseek" }, /* 19 */
+ { 0, 0, sys_getpid, "getpid" }, /* 20 */
+ { 5, TF, sys_mount, "mount" }, /* 21 */
+ { 2, TF, sys_umount, "umount" }, /* 22 */
+ { 1, 0, sys_setuid, "setuid" }, /* 23 */
+ { 0, 0, sys_getuid, "getuid" }, /* 24 */
+ { 1, 0, sys_stime, "stime" }, /* 25 */
+ { 4, 0, sys_ptrace, "ptrace" }, /* 26 */
+ { 1, 0, sys_alarm, "alarm" }, /* 27 */
+ { 0, TS, sys_pause, "pause" }, /* 28 */
+ { 2, TF, sys_utime, "utime" }, /* 29 */
+ { 2, TF, sys_stat, "stat" }, /* 30 */
+ { 2, TD, sys_fstat, "fstat" }, /* 31 */
+ { 2, TF, sys_lstat, "lstat" }, /* 32 */
+ { 2, TF, sys_access, "access" }, /* 33 */
+ { 1, TF, sys_chroot, "chroot" }, /* 34 */
+ { 0, 0, sys_sync, "sync" }, /* 35 */
+ { 1, TD, sys_fsync, "fsync" }, /* 36 */
+ { 2, TS, sys_kill, "kill" }, /* 37 */
+ { 2, TF, sys_rename, "rename" }, /* 38 */
+ { 2, TF, sys_mkdir, "mkdir" }, /* 39 */
+ { 1, TF, sys_rmdir, "rmdir" }, /* 40 */
+ { 1, TD, sys_dup, "dup" }, /* 41 */
+ { 1, TD, sys_pipe, "pipe" }, /* 42 */
+ { 1, 0, sys_times, "times" }, /* 43 */
+ { 5, TP, sys_clone, "clone" }, /* 44 */
+ { 1, 0, sys_brk, "brk" }, /* 45 */
+ { 1, 0, sys_setgid, "setgid" }, /* 46 */
+ { 0, 0, sys_getgid, "getgid" }, /* 47 */
+ { 2, TF, sys_getcwd, "getcwd" }, /* 48 */
+ { 0, 0, sys_geteuid, "geteuid" }, /* 49 */
+ { 0, 0, sys_getegid, "getegid" }, /* 50 */
+ { 1, TF, sys_acct, "acct" }, /* 51 */
+ { 1, 0, sys_setfsuid, "setfsuid" }, /* 52 */
+ { 1, 0, sys_setfsgid, "setfsgid" }, /* 53 */
+ { 3, TD, sys_ioctl, "ioctl" }, /* 54 */
+ { 3, TD, sys_fcntl, "fcntl" }, /* 55 */
+ { 2, 0, sys_setpgid, "setpgid" }, /* 56 */
+ { 4, 0, sys_mremap, "mremap" }, /* 57 */
+ { 3, 0, sys_setresuid, "setresuid" }, /* 58 */
+ { 3, 0, sys_getresuid, "getresuid" }, /* 59 */
+ { 2, 0, sys_setreuid, "setreuid" }, /* 60 */
+ { 2, 0, sys_setregid, "setregid" }, /* 61 */
+ { 2, 0, sys_ustat, "ustat" }, /* 62 */
+ { 2, TD, sys_dup2, "dup2" }, /* 63 */
+ { 0, 0, sys_getppid, "getppid" }, /* 64 */
+ { 0, 0, sys_getpgrp, "getpgrp" }, /* 65 */
+ { 0, 0, sys_setsid, "setsid" }, /* 66 */
+ { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 67 */
+ { 1, TS, printargs, "rt_sigreturn" }, /* 68 */
+ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 69 */
+ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 70 */
+ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 71 */
+ { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"}, /* 72 */
+ { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 73 */
+ { 2, 0, sys_sethostname, "sethostname" }, /* 74 */
+ { 2, 0, sys_setrlimit, "setrlimit" }, /* 75 */
+ { 2, 0, sys_getrlimit, "old_getrlimit" }, /* 76 */
+ { 2, 0, sys_getrusage, "getrusage" }, /* 77 */
+ { 2, 0, sys_gettimeofday, "gettimeofday" }, /* 78 */
+ { 2, 0, sys_settimeofday, "settimeofday" }, /* 79 */
+ { 2, 0, sys_getgroups, "getgroups" }, /* 80 */
+ { 2, 0, sys_setgroups, "setgroups" }, /* 81 */
+ { 5, TD, sys_select, "select" }, /* 82 */
+ { 2, TF, sys_symlink, "symlink" }, /* 83 */
+ { 1, TD, sys_fchdir, "fchdir" }, /* 84 */
+ { 3, TF, sys_readlink, "readlink" }, /* 85 */
+ { 5, TD, sys_pread, "pread" }, /* 86 */
+ { 5, TD, sys_pwrite, "pwrite" }, /* 87 */
+ { 1, TF, sys_swapon, "swapon" }, /* 88 */
+ { 3, 0, sys_reboot, "reboot" }, /* 89 */
+ { 6, 0, sys_mmap, "mmap" }, /* 90 */
+ { 2, 0, sys_munmap, "munmap" }, /* 91 */
+ { 2, TF, sys_truncate, "truncate" }, /* 92 */
+ { 2, TD, sys_ftruncate, "ftruncate" }, /* 93 */
+ { 2, TD, sys_fchmod, "fchmod" }, /* 94 */
+ { 3, TD, sys_fchown, "fchown" }, /* 95 */
+ { 2, 0, sys_getpriority, "getpriority" }, /* 96 */
+ { 3, 0, sys_setpriority, "setpriority" }, /* 97 */
+ { 4, TP, sys_wait4, "wait4" }, /* 98 */
+ { 2, TF, sys_statfs, "statfs" }, /* 99 */
+ { 2, TD, sys_fstatfs, "fstatfs" }, /* 100 */
+ { 0, 0, sys_vhangup, "vhangup" }, /* 101 */
+ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 102 */
+ { 3, 0, sys_syslog, "syslog" }, /* 103 */
+ { 3, 0, sys_setitimer, "setitimer" }, /* 104 */
+ { 2, 0, sys_getitimer, "getitimer" }, /* 105 */
+ { 1, 0, sys_swapoff, "swapoff" }, /* 106 */
+ { 1, 0, sys_sysinfo, "sysinfo" }, /* 107 */
+ { 6, 0, sys_ipc, "ipc" }, /* 108 */
+ { 4, TD|TN, sys_sendfile, "sendfile" }, /* 109 */
+ { 2, 0, sys_setdomainname, "setdomainname" }, /* 110 */
+ { 1, 0, sys_uname, "uname" }, /* 111 */
+ { 1, 0, sys_adjtimex, "adjtimex" }, /* 112 */
+ { 3, 0, sys_mprotect, "mprotect" }, /* 113 */
+ { 0, TP, sys_vfork, "vfork" }, /* 114 */
+ { 3, 0, sys_init_module, "init_module" }, /* 115 */
+ { 2, 0, sys_delete_module, "delete_module" }, /* 116 */
+ { 4, 0, sys_quotactl, "quotactl" }, /* 117 */
+ { 1, 0, sys_getpgid, "getpgid" }, /* 118 */
+ { 0, 0, sys_bdflush, "bdflush" }, /* 119 */
+ { 3, 0, sys_sysfs, "sysfs" }, /* 120 */
+ { 1, 0, sys_personality, "personality" }, /* 121 */
+ { 5, 0, sys_afs_syscall, "afs_syscall" }, /* 122 */
+ { 3, TD, sys_getdents, "getdents" }, /* 123 */
+ { 2, TD, sys_flock, "flock" }, /* 124 */
+ { 3, 0, sys_msync, "msync" }, /* 125 */
+ { 3, TD, sys_readv, "readv" }, /* 126 */
+ { 3, TD, sys_writev, "writev" }, /* 127 */
+ { 1, 0, sys_getsid, "getsid" }, /* 128 */
+ { 1, TD, sys_fdatasync, "fdatasync" }, /* 129 */
+ { 1, 0, sys_sysctl, "_sysctl" }, /* 130 */
+ { 2, 0, sys_mlock, "mlock" }, /* 131 */
+ { 2, 0, sys_munlock, "munlock" }, /* 132 */
+ { 2, 0, sys_mlockall, "mlockall" }, /* 133 */
+ { 0, 0, sys_munlockall, "munlockall" }, /* 134 */
+ { 0, 0, sys_sched_setparam, "sched_setparam"}, /* 135 */
+ { 2, 0, sys_sched_getparam, "sched_getparam"}, /* 136 */
+ { 3, 0, sys_sched_setscheduler, "sched_setscheduler"}, /* 137 */
+ { 1, 0, sys_sched_getscheduler, "sched_getscheduler"}, /* 138 */
+ { 0, 0, sys_sched_yield, "sched_yield"}, /* 139 */
+ { 1, 0, sys_sched_get_priority_max,"sched_get_priority_max"}, /* 140 */
+ { 1, 0, sys_sched_get_priority_min,"sched_get_priority_min"}, /* 141 */
+ { 2, 0, sys_sched_rr_get_interval,"sched_rr_get_interval"}, /* 142 */
+ { 2, 0, sys_nanosleep, "nanosleep" }, /* 143 */
+ { 3, TD, sys_poll, "poll" }, /* 144 */
+ { 3, 0, printargs, "nfsservctl" }, /* 145 */
+ { 3, 0, sys_setresgid, "setresgid" }, /* 146 */
+ { 3, 0, sys_getresgid, "getresgid" }, /* 147 */
+ { 5, 0, sys_prctl, "prctl" }, /* 148 */
+ { 3, TN, sys_socket, "socket" }, /* 149 */
+ { 3, TN, sys_bind, "bind" }, /* 150 */
+ { 3, TN, sys_connect, "connect" }, /* 151 */
+ { 2, TN, sys_listen, "listen" }, /* 152 */
+ { 3, TN, sys_accept, "accept" }, /* 153 */
+ { 3, TN, sys_getsockname, "getsockname" }, /* 154 */
+ { 3, TN, sys_getpeername, "getpeername" }, /* 155 */
+ { 4, TN, sys_socketpair, "socketpair" }, /* 156 */
+ { 4, TN, sys_send, "send" }, /* 157 */
+ { 4, TN, sys_recv, "recv" }, /* 158 */
+ { 6, TN, sys_sendto, "sendto" }, /* 159 */
+ { 6, TN, sys_recvfrom, "recvfrom" }, /* 160 */
+ { 2, TN, sys_shutdown, "shutdown" }, /* 161 */
+ { 5, TN, sys_setsockopt, "setsockopt" }, /* 162 */
+ { 5, TN, sys_getsockopt, "getsockopt" }, /* 163 */
+ { 5, TN, sys_sendmsg, "sendmsg" }, /* 164 */
+ { 5, TN, sys_recvmsg, "recvmsg" }, /* 165 */
+ { 3, TF, sys_truncate64, "truncate64" }, /* 166 */
+ { 3, TD, sys_ftruncate64, "ftruncate64" }, /* 167 */
+ { 2, TF, sys_stat64, "stat64" }, /* 168 */
+ { 2, TF, sys_lstat64, "lstat64" }, /* 169 */
+ { 2, TD, sys_fstat64, "fstat64" }, /* 170 */
+ { 2, TF, sys_pivotroot, "pivot_root" }, /* 171 */
+ { 3, 0, printargs, "mincore" }, /* 172 */
+ { 3, 0, sys_madvise, "madvise" }, /* 173 */
+ { 3, TD, sys_getdents64, "getdents64" }, /* 174 */
+ { 3, TD, sys_fcntl, "fcntl64" }, /* 175 */
+ { 0, 0, printargs, "gettid" }, /* 176 */
+ { 4, TD, sys_readahead, "readahead" }, /* 177 */
+ { 5, TF, sys_setxattr, "setxattr" }, /* 178 */
+ { 5, TF, sys_setxattr, "lsetxattr" }, /* 179 */
+ { 5, TD, sys_fsetxattr, "fsetxattr" }, /* 180 */
+ { 4, TF, sys_getxattr, "getxattr" }, /* 181 */
+ { 4, TF, sys_getxattr, "lgetxattr" }, /* 182 */
+ { 4, 0, sys_fgetxattr, "fgetxattr" }, /* 183 */
+ { 3, TF, sys_listxattr, "listxattr" }, /* 184 */
+ { 3, TF, sys_listxattr, "llistxattr" }, /* 185 */
+ { 3, 0, sys_flistxattr, "flistxattr" }, /* 186 */
+ { 2, TF, sys_removexattr, "removexattr" }, /* 187 */
+ { 2, TF, sys_removexattr, "lremovexattr" }, /* 188 */
+ { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 189 */
+ { 2, 0, sys_kill, "tkill" }, /* 190 */
+ { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 191 */
+ { 6, 0, sys_futex, "futex" }, /* 192 */
+ { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },/* 193 */
+ { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },/* 194 */
+ { 2, 0, sys_capget, "capget" }, /* 195 */
+ { 2, 0, sys_capset, "capset" }, /* 196 */
+ { 2, 0, sys_io_setup, "io_setup" }, /* 197 */
+ { 1, 0, sys_io_destroy, "io_destroy" }, /* 198 */
+ { 5, 0, sys_io_getevents, "io_getevents" }, /* 199 */
+ { 3, 0, sys_io_submit, "io_submit" }, /* 200 */
+ { 3, 0, sys_io_cancel, "io_cancel" }, /* 201 */
+ { 5, 0, sys_fadvise64, "fadvise64" }, /* 202 */
+ { 1, TP, sys_exit, "exit_group" }, /* 203 */
+ { 4, 0, printargs, "lookup_dcookie"}, /* 204 */
+ { 1, 0, sys_epoll_create, "epoll_create" }, /* 205 */
+ { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 206 */
+ { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 207 */
+ { 5, 0, sys_remap_file_pages, "remap_file_pages"}, /* 208 */
+ { 1, 0, printargs, "set_tid_address"}, /* 209 */
+ { 3, 0, sys_timer_create, "timer_create" }, /* 210 */
+ { 4, 0, sys_timer_settime, "timer_settime" }, /* 211 */
+ { 2, 0, sys_timer_gettime, "timer_gettime" }, /* 212 */
+ { 1, 0, sys_timer_getoverrun, "timer_getoverrun"}, /* 213 */
+ { 1, 0, sys_timer_delete, "timer_delete" }, /* 214 */
+ { 2, 0, sys_clock_settime, "clock_settime" }, /* 215 */
+ { 2, 0, sys_clock_gettime, "clock_gettime" }, /* 216 */
+ { 2, 0, sys_clock_getres, "clock_getres" }, /* 217 */
+ { 4, 0, sys_clock_nanosleep, "clock_nanosleep"}, /* 218 */
+ { 3, TF, sys_statfs64, "statfs64" }, /* 219 */
+ { 3, TD, sys_fstatfs64, "fstatfs64" }, /* 220 */
+ { 3, TS, sys_tgkill, "tgkill" }, /* 221 */
+ { 5, 0, printargs, "SYS_222" }, /* 222 */
+ { 2, TF, sys_utimes, "utimes" }, /* 223 */
+ { 6, 0, sys_fadvise64_64, "fadvise64_64" }, /* 224 */
+ { 3, 0, printargs, "cacheflush" }, /* 225 */
+ { 5, 0, printargs, "vserver" }, /* 226 */
+ { 4, 0, sys_mq_open, "mq_open" }, /* 227 */
+ { 1, 0, sys_mq_unlink, "mq_unlink" }, /* 228 */
+ { 5, 0, sys_mq_timedsend, "mq_timedsend" }, /* 229 */
+ { 5, 0, sys_mq_timedreceive, "mq_timedreceive" }, /* 230 */
+ { 2, 0, sys_mq_notify, "mq_notify" }, /* 231 */
+ { 3, 0, sys_mq_getsetattr, "mq_getsetattr" }, /* 232 */
+ { 5, 0, printargs, "kexec_load" }, /* 233 */
+ { 5, TP, sys_waitid, "waitid" }, /* 234 */
+ { 5, 0, printargs, "add_key" }, /* 235 */
+ { 4, 0, printargs, "request_key" }, /* 236 */
+ { 5, 0, printargs, "keyctl" }, /* 237 */
+ { 3, 0, printargs, "ioprio_set" }, /* 238 */
+ { 2, 0, printargs, "ioprio_get" }, /* 239 */
+ { 0, 0, printargs, "inotify_init" }, /* 240 */
+ { 3, TD, sys_inotify_add_watch, "inotify_add_watch" }, /* 241 */
+ { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" }, /* 242 */
+ { 4, TD|TF, sys_openat, "openat" }, /* 243 */
+ { 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 244 */
+ { 4, TD|TF, sys_mknodat, "mknodat" }, /* 245 */
+ { 5, TD|TF, sys_fchownat, "fchownat" }, /* 246 */
+ { 3, TD|TF, sys_futimesat, "futimesat" }, /* 247 */
+ { 4, TD|TF, printargs, "fstatat64" }, /* 248 */
+ { 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 249 */
+ { 4, TD|TF, sys_renameat, "renameat" }, /* 250 */
+ { 5, TD|TF, sys_linkat, "linkat" }, /* 251 */
+ { 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 252 */
+ { 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 253 */
+ { 3, TD|TF, sys_fchmodat, "fchmodat" }, /* 254 */
+ { 3, TD|TF, sys_faccessat, "faccessat" }, /* 255 */
+ { 6, TD, sys_pselect6, "pselect6" }, /* 256 */
+ { 5, TD, sys_ppoll, "ppoll" }, /* 257 */
+ { 1, TD, sys_unshare, "unshare" }, /* 258 */
+ { 2, 0, printargs, "set_robust_list" }, /* 259 */
+ { 3, 0, printargs, "get_robust_list" }, /* 260 */
+ { 6, TD, printargs, "splice" }, /* 261 */
+ { 4, TD, printargs, "sync_file_range" }, /* 262 */
+ { 4, TD, printargs, "tee" }, /* 263 */
+ { 4, TD, printargs, "vmsplice" }, /* 264 */
+ { 5, TD, sys_epoll_pwait, "epoll_pwait" }, /* 265 */
+ { 4, TI, sys_msgget, "msgget" }, /* 266 */
+ { 4, TI, sys_msgsnd, "msgsnd" }, /* 267 */
+ { 5, TI, sys_msgrcv, "msgrcv" }, /* 268 */
+ { 3, TI, sys_msgctl, "msgctl" }, /* 269 */
+ { 4, TI, sys_semget, "semget" }, /* 270 */
+ { 4, TI, sys_semop, "semop" }, /* 271 */
+ { 4, TI, sys_semctl, "semctl" }, /* 272 */
+ { 5, TI, sys_semtimedop, "semtimedop" }, /* 273 */
+ { 4, TI, sys_shmat, "shmat" }, /* 274 */
+ { 4, TI, sys_shmget, "shmget" }, /* 275 */
+ { 4, TI, sys_shmdt, "shmdt" }, /* 276 */
+ { 4, TI, sys_shmctl, "shmctl" }, /* 277 */
+ { 4, TD|TF, sys_utimensat, "utimensat" }, /* 278 */
+ { 3, TD|TS, sys_signalfd, "signalfd" }, /* 279 */
+ { 2, TD, sys_timerfd, "timerfd_create" }, /* 280 */
+ { 1, TD, sys_eventfd, "eventfd" }, /* 281 */
diff --git a/process.c b/process.c
index bcd9720..adbd5c2 100644
--- a/process.c
+++ b/process.c
@@ -728,6 +728,10 @@ change_syscall(struct tcb *tcp, int new)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), new)<0)
return -1;
return 0;
+#elif defined(AVR32)
+ if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_R8), new) < 0)
+ return -1;
+ return 0;
#elif defined(BFIN)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_P0), new)<0)
return -1;
@@ -788,7 +792,29 @@ setarg(tcp, argnum)
struct tcb *tcp;
int argnum;
{
-#if defined (IA64)
+#if defined(AVR32)
+ {
+ errno = 0;
+ if (argnum == 0)
+ ptrace(PTRACE_POKEUSER, tcp->pid,
+ (char *)(REG_R12_ORIG),
+ tcp->u_arg[argnum]);
+ else if (argnum < 4)
+ /* r11 .. r9 */
+ ptrace(PTRACE_POKEUSER, tcp->pid,
+ (char *)(REG_R12 - 4 * argnum),
+ tcp->u_arg[argnum]);
+ else if (argnum < 6)
+ /* r6 .. r5 */
+ ptrace(PTRACE_POKEUSER, tcp->pid,
+ (char *)(REG_R10 - 4 * argnum),
+ tcp->u_arg[argnum]);
+ else
+ return -E2BIG;
+ if (errno)
+ return -1;
+ }
+elif defined(IA64)
{
unsigned long *bsp, *ap;
@@ -2994,7 +3020,26 @@ const struct xlat struct_user_offsets[] = {
{ uoff(regs.ARM_pc), "pc" },
{ uoff(regs.ARM_cpsr), "cpsr" },
#endif
-
+#ifdef AVR32
+ { uoff(regs.sr), "sr" },
+ { uoff(regs.pc), "pc" },
+ { uoff(regs.lr), "lr" },
+ { uoff(regs.sp), "sp" },
+ { uoff(regs.r12), "r12" },
+ { uoff(regs.r11), "r11" },
+ { uoff(regs.r10), "r10" },
+ { uoff(regs.r9), "r9" },
+ { uoff(regs.r8), "r8" },
+ { uoff(regs.r7), "r7" },
+ { uoff(regs.r6), "r6" },
+ { uoff(regs.r5), "r5" },
+ { uoff(regs.r4), "r4" },
+ { uoff(regs.r3), "r3" },
+ { uoff(regs.r2), "r2" },
+ { uoff(regs.r1), "r1" },
+ { uoff(regs.r0), "r0" },
+ { uoff(regs.r12_orig), "orig_r12" },
+#endif
#ifdef MIPS
{ 0, "r0" },
{ 1, "r1" },
@@ -3069,7 +3114,7 @@ const struct xlat struct_user_offsets[] = {
{ 70, "fpeir" },
#endif
-#if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(BFIN)
+#if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(AVR32) && !defined(BFIN)
{ uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
#endif
#if defined(I386) || defined(X86_64)
@@ -3085,20 +3130,20 @@ const struct xlat struct_user_offsets[] = {
#if !defined(SPARC64)
{ uoff(start_code), "offsetof(struct user, start_code)" },
#endif
-#ifdef SH64
+#if defined(AVR32) || defined(SH64)
{ uoff(start_data), "offsetof(struct user, start_data)" },
#endif
#if !defined(SPARC64)
{ uoff(start_stack), "offsetof(struct user, start_stack)" },
#endif
{ uoff(signal), "offsetof(struct user, signal)" },
-#if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH) && !defined(SH64) && !defined(SPARC64)
+#if !defined(AVR32) && !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH) && !defined(SH64) && !defined(SPARC64)
{ uoff(reserved), "offsetof(struct user, reserved)" },
#endif
#if !defined(SPARC64)
{ uoff(u_ar0), "offsetof(struct user, u_ar0)" },
#endif
-#if !defined(ARM) && !defined(MIPS) && !defined(S390) && !defined(S390X) && !defined(SPARC64) && !defined(BFIN)
+#if !defined(ARM) && !defined(AVR32) && !defined(MIPS) && !defined(S390) && !defined(S390X) && !defined(SPARC64) && !defined(BFIN)
{ uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
#endif
{ uoff(magic), "offsetof(struct user, magic)" },
diff --git a/syscall.c b/syscall.c
index 2316e68..944aa40 100644
--- a/syscall.c
+++ b/syscall.c
@@ -753,6 +753,8 @@ internal_syscall(struct tcb *tcp)
#elif defined (ALPHA)
static long r0;
static long a3;
+#elif defined(AVR32)
+ static struct pt_regs regs;
#elif defined (SPARC) || defined (SPARC64)
static struct regs regs;
static unsigned long trap;
@@ -897,6 +899,25 @@ get_scno(struct tcb *tcp)
return 0;
}
}
+#elif defined(AVR32)
+ /*
+ * Read complete register set in one go.
+ */
+ if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, ®s) < 0)
+ return -1;
+
+ /*
+ * We only need to grab the syscall number on syscall entry.
+ */
+ if (!(tcp->flags & TCB_INSYSCALL)) {
+ scno = regs.r8;
+
+ /* Check if we return from execve. */
+ if (tcp->flags & TCB_WAITEXECVE) {
+ tcp->flags &= ~TCB_WAITEXECVE;
+ return 0;
+ }
+ }
#elif defined(BFIN)
if (upeek(tcp, PT_ORIG_P0, &scno))
return -1;
@@ -1618,6 +1639,16 @@ struct tcb *tcp;
u_error = 0;
}
#else /* !ARM */
+#ifdef AVR32
+ if (regs.r12 && (unsigned) -regs.r12 < nerrnos) {
+ tcp->u_rval = -1;
+ u_error = -regs.r12;
+ }
+ else {
+ tcp->u_rval = regs.r12;
+ u_error = 0;
+ }
+#else /* !AVR32 */
#ifdef BFIN
if (is_negated_errno(r0)) {
tcp->u_rval = -1;
@@ -1695,6 +1726,7 @@ struct tcb *tcp;
#endif /* SPARC64 */
#endif /* ALPHA */
#endif /* BFIN */
+#endif /* AVR32 */
#endif /* ARM */
#endif /* M68K */
#endif /* POWERPC */
@@ -1865,6 +1897,11 @@ force_result(tcp, error, rval)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*0), regs.ARM_r0) < 0)
return -1;
#else /* !ARM */
+#ifdef AVR32
+ regs.r12 = error ? -error : rval;
+ if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)REG_R12, regs.r12) < 0)
+ return -1;
+#else /* !AVR32 */
#ifdef ALPHA
if (error) {
a3 = -1;
@@ -1926,6 +1963,7 @@ force_result(tcp, error, rval)
#endif /* SPARC */
#endif /* SPARC64 */
#endif /* ALPHA */
+#endif /* AVR32 */
#endif /* ARM */
#endif /* M68K */
#endif /* POWERPC */
@@ -2159,6 +2197,14 @@ struct tcb *tcp;
for (i = 0; i < tcp->u_nargs; i++)
tcp->u_arg[i] = regs.uregs[i];
}
+#elif defined(AVR32)
+ tcp->u_nargs = sysent[tcp->scno].nargs;
+ tcp->u_arg[0] = regs.r12;
+ tcp->u_arg[1] = regs.r11;
+ tcp->u_arg[2] = regs.r10;
+ tcp->u_arg[3] = regs.r9;
+ tcp->u_arg[4] = regs.r5;
+ tcp->u_arg[5] = regs.r3;
#elif defined(BFIN)
{
int i;
diff --git a/util.c b/util.c
index 83a9f1d..c4075ff 100644
--- a/util.c
+++ b/util.c
@@ -1162,6 +1162,9 @@ struct tcb *tcp;
# elif defined(ARM)
if (upeek(tcp, 4*15, &pc) < 0)
return -1;
+# elif defined(AVR32)
+ if (upeek(tcp->pid, REG_PC, &pc) < 0)
+ return -1;
# elif defined(BFIN)
if (upeek(tcp, REG_PC, &pc) < 0)
return -1;
@@ -1342,6 +1345,14 @@ struct tcb *tcp;
return;
}
tprintf("[%08lx] ", pc);
+#elif defined(AVR32)
+ long pc;
+
+ if (upeek(tcp, REG_PC, &pc) < 0) {
+ tprintf("[????????] ");
+ return;
+ }
+ tprintf("[%08lx] ", pc);
# elif defined(BFIN)
long pc;
@@ -1536,6 +1547,9 @@ typedef struct regs arg_setup_state;
# elif defined (ALPHA) || defined (MIPS)
# define arg0_offset REG_A0
# define arg1_offset (REG_A0+1)
+# elif defined (AVR32)
+# define arg0_offset (REG_R12)
+# define arg1_offset (REG_R11)
# elif defined (POWERPC)
# define arg0_offset (sizeof(unsigned long)*PT_R3)
# define arg1_offset (sizeof(unsigned long)*PT_R4)
--
1.5.6.3
More information about the Strace-devel
mailing list