[PATCH] Add support for ARC architecture (Synopsys)
Vineet Gupta
Vineet.Gupta1 at synopsys.com
Tue Mar 15 12:28:40 UTC 2011
From: Vineet Gupta <vgupta at synopsys.com>
* configure.ac: Add ARC architecture
* defs.h: Define TCB_WAITEXECVE for ARC
* linux/arc/syscall.h: ARC specific new file
* Makefile.am: Add linux/arc/syscall.h
* process.c (change_syscall, struct_user_offsets): Add ARC support
* syscall.c (get_scno, get_error, syscall_enter): Likewise.
* signal.c (sys_sigreturn): Add ARC support
Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
---
Makefile.am | 1 +
configure.ac | 4 +
defs.h | 3 +-
linux/arc/syscallent.h | 355 ++++++++++++++++++++++++++++++++++++++++++++++++
process.c | 25 +++-
signal.c | 27 ++++
syscall.c | 49 +++++++
util.c | 10 ++
8 files changed, 470 insertions(+), 4 deletions(-)
create mode 100644 linux/arc/syscallent.h
diff --git a/Makefile.am b/Makefile.am
index ba19a7d..667b216 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -78,6 +78,7 @@ EXTRA_DIST = $(man_MANS) errnoent.sh signalent.sh syscallent.sh ioctlsort.c \
linux/sparc64/syscallent.h linux/sparc64/syscallent1.h \
linux/sparc64/syscallent2.h \
linux/tile/ioctlent.h.in linux/tile/syscallent.h \
+ linux/arc/syscallent.h \
linux/x86_64/ioctlent.h.in linux/x86_64/syscallent.h \
linux/x86_64/gentab.pl \
linux/x86_64/errnoent1.h linux/x86_64/ioctlent1.h \
diff --git a/configure.ac b/configure.ac
index c14c011..e95602e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,6 +131,10 @@ microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
+arc*)
+ arch=arc
+ AC_DEFINE([ARC], 1, [Define for the ARC 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 7271280..a6f2b7f 100644
--- a/defs.h
+++ b/defs.h
@@ -406,7 +406,8 @@ struct tcb {
# 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) || defined(TILE)
+ || defined(ARM) || defined(MIPS) || defined(BFIN) || defined(TILE) \
+ || defined(ARC)
# define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */
# endif
# define TCB_CLONE_THREAD 010000 /* CLONE_THREAD set in creating syscall */
diff --git a/linux/arc/syscallent.h b/linux/arc/syscallent.h
new file mode 100644
index 0000000..31e62e9
--- /dev/null
+++ b/linux/arc/syscallent.h
@@ -0,0 +1,355 @@
+ { -1, 0, printargs, "SYS_0" }, /* 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, printargs, "SYS_7" }, /* 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, "lchown16" }, /* 16 */
+ { -1, 0, sys_break, "break" }, /* 17 */
+ { 2, TF, sys_oldstat, "oldstat" }, /* 18 */
+ { -1, 0, sys_lseek, "lseek" }, /* 19 */
+ { 0, 0, sys_getpid, "getpid" }, /* 20 */
+ { 5, TF, sys_mount, "mount" }, /* 21 */
+ { 1, TF, sys_umount, "umount" }, /* 22 */
+ { 1, 0, sys_setuid, "setuid" }, /* 23 */
+ { 0, NF, sys_getuid, "getuid" }, /* 24 */
+ { 1, 0, sys_stime, "stime" }, /* 25 */
+ { 4, 0, sys_ptrace, "ptrace" }, /* 26 */
+ { 1, 0, sys_alarm, "alarm" }, /* 27 */
+ { 2, 0, sys_oldfstat, "oldfstat" }, /* 28 */
+ { 0, TS, sys_pause, "pause" }, /* 29 */
+ { 2, TF, sys_utime, "utime" }, /* 30 */
+ { 2, 0, sys_stty, "stty" }, /* 31 */
+ { 2, 0, sys_gtty, "gtty" }, /* 32 */
+ { 2, TF, sys_access, "access" }, /* 33 */
+ { 1, 0, sys_nice, "nice" }, /* 34 */
+ { 0, 0, sys_ftime, "ftime" }, /* 35 */
+ { 0, 0, sys_sync, "sync" }, /* 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, 0, sys_dup, "dup" }, /* 41 */
+ { 1, 0, sys_pipe, "pipe" }, /* 42 */
+ { 1, 0, sys_times, "times" }, /* 43 */
+ { 0, 0, sys_prof, "prof" }, /* 44 */
+ { 1, 0, sys_brk, "brk" }, /* 45 */
+ { 0, 0, sys_setgid, "setgid" }, /* 46 */
+ { 0, NF, sys_getgid, "getgid" }, /* 47 */
+ { 3, TS, sys_signal, "signal" }, /* 48 */
+ { 0, NF, sys_geteuid, "geteuid" }, /* 49 */
+ { 0, NF, sys_getegid, "getegid" }, /* 50 */
+ { 1, TF, sys_acct, "acct" }, /* 51 */
+ { 2, TF, sys_umount2, "umount2" }, /* 52 */
+ { 0, 0, sys_lock, "lock" }, /* 53 */
+ { 3, 0, sys_ioctl, "ioctl" }, /* 54 */
+ { 3, 0, sys_fcntl, "fcntl" }, /* 55 */
+ { 0, 0, sys_mpx, "mpx" }, /* 56 */
+ { 2, 0, sys_setpgid, "setpgid" }, /* 57 */
+ { 2, 0, sys_ulimit, "ulimit" }, /* 58 */
+ { 1, 0, sys_oldolduname, "oldolduname" }, /* 59 */
+ { 1, 0, sys_umask, "umask" }, /* 60 */
+ { 1, TF, sys_chroot, "chroot" }, /* 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 */
+ { 3, TS, sys_sigaction, "sigaction" }, /* 67 */
+ { -1, 0, printargs, "SYS_68" }, /* 68 */
+ { -1, 0, printargs, "SYS_69" }, /* 69 */
+ { 2, 0, sys_setreuid, "setreuid" }, /* 70 */
+ { 2, 0, sys_setregid, "setregid" }, /* 71 */
+ { 3, TS, sys_sigsuspend, "sigsuspend" }, /* 72 */
+ { 1, TS, sys_sigpending, "sigpending" }, /* 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 */
+ { 1, 0, sys_oldselect, "oldselect" }, /* 82 */
+ { 2, TF, sys_symlink, "symlink" }, /* 83 */
+ { 2, TF, sys_oldlstat, "oldlstat" }, /* 84 */
+ { 3, TF, sys_readlink, "readlink" }, /* 85 */
+ { 1, TF, sys_uselib, "uselib" }, /* 86 */
+ { 1, TF, sys_swapon, "swapon" }, /* 87 */
+ { 3, 0, sys_reboot, "reboot" }, /* 88 */
+ { 3, 0, sys_readdir, "readdir" }, /* 89 */
+ { 6, TD, sys_old_mmap, "oldmmap" }, /* 90 */
+ { 2, 0, sys_munmap, "munmap" }, /* 91 */
+ { 2, TF, sys_truncate, "truncate" }, /* 92 */
+ { 2, 0, sys_ftruncate, "ftruncate" }, /* 93 */
+ { 2, 0, sys_fchmod, "fchmod" }, /* 94 */
+ { 3, 0, sys_fchown, "fchown16" }, /* 95 */
+ { 2, 0, sys_getpriority, "getpriority" }, /* 96 */
+ { 3, 0, sys_setpriority, "setpriority" }, /* 97 */
+ { 4, 0, sys_profil, "profil" }, /* 98 */
+ { 2, TF, sys_statfs, "statfs" }, /* 99 */
+ { 2, 0, sys_fstatfs, "fstatfs" }, /* 100 */
+ { 3, 0, sys_ioperm, "ioperm" }, /* 101 */
+ { 2, 0, sys_socketcall, "socketcall" }, /* 102 */
+ { 3, 0, sys_syslog, "syslog" }, /* 103 */
+ { 3, 0, sys_setitimer, "setitimer" }, /* 104 */
+ { 2, 0, sys_getitimer, "getitimer" }, /* 105 */
+ { 2, TF, sys_stat, "stat" }, /* 106 */
+ { 2, TF, sys_lstat, "lstat" }, /* 107 */
+ { 2, 0, sys_fstat, "fstat" }, /* 108 */
+ { 1, 0, sys_olduname, "olduname" }, /* 109 */
+ { 1, 0, sys_iopl, "iopl" }, /* 110 */
+ { 0, 0, sys_vhangup, "vhangup" }, /* 111 */
+ { 0, 0, sys_idle, "idle" }, /* 112 */
+ { -1, 0, printargs, "SYS_113" }, /* 113 */
+ { 4, TP, sys_wait4, "wait4" }, /* 114 */
+ { 1, TF, sys_swapoff, "swapoff" }, /* 115 */
+ { 1, 0, sys_sysinfo, "sysinfo" }, /* 116 */
+ { 6, 0, sys_ipc, "ipc" }, /* 117 */
+ { 1, 0, sys_fsync, "fsync" }, /* 118 */
+ { 1, TS, sys_sigreturn, "sigreturn" }, /* 119 */
+ { 5, TP, sys_clone, "clone" }, /* 120 */
+ { 2, 0, sys_setdomainname, "setdomainname" }, /* 121 */
+ { 1, 0, sys_uname, "uname" }, /* 122 */
+ { -1, 0, printargs, "cacheflush" }, /* 123 */
+ { 1, 0, sys_adjtimex, "adjtimex" }, /* 124 */
+ { 3, 0, sys_mprotect, "mprotect" }, /* 125 */
+ { 3, TS, sys_sigprocmask, "sigprocmask" }, /* 126 */
+ { 2, 0, sys_create_module, "create_module" }, /* 127 */
+ { 3, 0, sys_init_module, "init_module" }, /* 128 */
+ { 2, 0, sys_delete_module, "delete_module" }, /* 129 */
+ { 1, 0, sys_get_kernel_syms, "get_kernel_syms"}, /* 130 */
+ { 4, 0, sys_quotactl, "quotactl" }, /* 131 */
+ { 1, 0, sys_getpgid, "getpgid" }, /* 132 */
+ { 1, 0, sys_fchdir, "fchdir" }, /* 133 */
+ { 0, 0, sys_bdflush, "bdflush" }, /* 134 */
+ { 3, 0, sys_sysfs, "sysfs" }, /* 135 */
+ { 1, 0, sys_personality, "personality" }, /* 136 */
+ { 5, 0, sys_afs_syscall, "afs_syscall" }, /* 137 */
+ { 1, NF, sys_setfsuid, "setfsuid" }, /* 138 */
+ { 1, NF, sys_setfsgid, "setfsgid" }, /* 139 */
+ { 5, 0, sys_llseek, "llseek" }, /* 140 */
+ { 3, 0, sys_getdents, "getdents" }, /* 141 */
+ { 5, 0, sys_select, "select" }, /* 142 */
+ { 2, 0, sys_flock, "flock" }, /* 143 */
+ { 3, 0, sys_msync, "msync" }, /* 144 */
+ { 3, 0, sys_readv, "readv" }, /* 145 */
+ { 3, 0, sys_writev, "writev" }, /* 146 */
+ { 1, 0, sys_getsid, "getsid" }, /* 147 */
+ { 1, 0, sys_fdatasync, "fdatasync" }, /* 148 */
+ { 1, 0, sys_sysctl, "sysctl" }, /* 149 */
+ { 2, 0, sys_mlock, "mlock" }, /* 150 */
+ { 2, 0, sys_munlock, "munlock" }, /* 151 */
+ { 2, 0, sys_mlockall, "mlockall" }, /* 152 */
+ { 0, 0, sys_munlockall, "munlockall" }, /* 153 */
+ { 0, 0, sys_sched_setparam, "sched_setparam"}, /* 154 */
+ { 2, 0, sys_sched_getparam, "sched_getparam"}, /* 155 */
+ { 3, 0, sys_sched_setscheduler, "sched_setscheduler"}, /* 156 */
+ { 1, 0, sys_sched_getscheduler, "sched_getscheduler"}, /* 157 */
+ { 0, 0, sys_sched_yield, "sched_yield" }, /* 158 */
+ { 1, 0, sys_sched_get_priority_max,"sched_get_priority_max"}, /* 159 */
+ { 1, 0, sys_sched_get_priority_min,"sched_get_priority_min"}, /* 160 */
+ { 2, 0, sys_sched_rr_get_interval,"sched_rr_get_interval"}, /* 161 */
+ { 2, 0, sys_nanosleep, "nanosleep" }, /* 162 */
+ { 5, 0, sys_mremap, "mremap" }, /* 163 */
+ { 3, 0, sys_setresuid, "setresuid" }, /* 164 */
+ { 3, 0, sys_getresuid, "getresuid" }, /* 165 */
+ { -1, 0, printargs, "SYS_166" }, /* 166 */
+ { 5, 0, sys_query_module, "query_module" }, /* 167 */
+ { 3, 0, sys_poll, "poll" }, /* 168 */
+ { -1, 0, printargs, "nfsservctl" }, /* 169 */
+ { 3, 0, sys_setresgid, "setresgid" }, /* 170 */
+ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */
+ { 5, 0, sys_prctl, "prctl" }, /* 172 */
+ { 1, 0, sys_sigreturn, "rt_sigreturn" }, /* 173 */
+ { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */
+ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */
+ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */
+ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */
+ { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"}, /* 178 */
+ { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 179 */
+ { 5, TF, sys_pread, "pread" }, /* 180 */
+ { 5, TF, sys_pwrite, "pwrite" }, /* 181 */
+ { 3, TF, sys_chown, "chown16" }, /* 182 */
+ { 2, TF, sys_getcwd, "getcwd" }, /* 183 */
+ { 2, 0, sys_capget, "capget" }, /* 184 */
+ { 2, 0, sys_capset, "capset" }, /* 185 */
+ { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */
+ { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */
+ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */
+ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */
+ { 0, TP, sys_vfork, "vfork" }, /* 190 */
+ { 2, 0, sys_getrlimit, "getrlimit" }, /* 191 */
+ { 6, TD, sys_mmap, "mmap2" }, /* 192 */
+ { 3, TF, sys_truncate64, "truncate64" }, /* 193 */
+ { 3, TF, sys_ftruncate64, "ftruncate64" }, /* 194 */
+ { 2, TF, sys_stat64, "stat64" }, /* 195 */
+ { 2, TF, sys_lstat64, "lstat64" }, /* 196 */
+ { 2, TF, sys_fstat64, "fstat64" }, /* 197 */
+ { 3, TF, sys_chown, "chown32" }, /* 198 */
+ { 0, NF, sys_getuid, "getuid32" }, /* 199 */
+ { 0, NF, sys_getgid, "getgid32" }, /* 200 */
+ { 0, NF, sys_geteuid, "geteuid32" }, /* 201 */
+ { 0, NF, sys_getegid, "getegid32" }, /* 202 */
+ { 2, 0, sys_setreuid, "setreuid32" }, /* 203 */
+ { 2, 0, sys_setregid, "setregid32" }, /* 204 */
+ { 2, 0, sys_getgroups, "getgroups32" }, /* 205 */
+ { 2, 0, sys_setgroups, "setgroups32" }, /* 206 */
+ { 3, 0, sys_chown, "fchown32" }, /* 207 */
+ { 3, 0, sys_setresuid, "setresuid32" }, /* 208 */
+ { 3, 0, sys_getresuid, "getresuid32" }, /* 209 */
+ { 3, 0, sys_setresgid, "setresgid32" }, /* 210 */
+ { 3, 0, sys_getresgid, "getresgid32" }, /* 211 */
+ { 3, TF, sys_chown, "lchown32" }, /* 212 */
+ { 1, 0, sys_setuid, "setuid32" }, /* 213 */
+ { 1, 0, sys_setgid, "setgid32" }, /* 214 */
+ { 1, 0, sys_setfsuid, "setfsuid32" }, /* 215 */
+ { 1, 0, sys_setfsgid, "setfsgid32" }, /* 216 */
+ { 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */
+ { -1, 0, printargs, "SYS_218" }, /* 218 */
+ { -1, 0, printargs, "SYS_219" }, /* 219 */
+ { 3, 0, sys_getdents64, "getdents64" }, /* 220 */
+ { 3, 0, sys_fcntl, "fcntl64" }, /* 221 */
+ { -1, 0, printargs, "SYS_222" }, /* 222 */
+ { -1, 0, printargs, "SYS_223" }, /* 223 */
+ { -1, 0, printargs, "gettid" }, /* 224 */
+ { 4, 0, printargs, "lookup_dcookie"}, /* 225 */
+ { 3, 0, sys_statfs64, "statfs64" }, /* 226 */
+ { 3, 0, sys_waitpid, "waitpid" }, /* 227 */
+ { 4, 0, sys_mq_open, "mq_open" }, /* 228 */
+ { 1, 0, sys_mq_unlink, "mq_unlink" }, /* 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, sys_mq_timedsend, "mq_timedsend" }, /* 233 */
+ { 3, 0, sys_timer_create, "timer_create" }, /* 234 */
+ { 4, 0, sys_timer_settime, "timer_settime" }, /* 235 */
+ { 2, 0, sys_timer_gettime, "timer_gettime" }, /* 236 */
+ { 1, 0, sys_timer_getoverrun, "timer_getoverrun"}, /* 237 */
+ { 1, 0, sys_timer_delete, "timer_delete" }, /* 238 */
+ { 2, 0, sys_clock_settime, "clock_settime" }, /* 239 */
+ { 2, 0, sys_clock_gettime, "clock_gettime" }, /* 240 */
+ { 2, 0, sys_clock_getres, "clock_getres" }, /* 241 */
+ { 4, 0, sys_clock_nanosleep, "clock_nanosleep"}, /* 242 */
+ { 3, 0, sys_sched_setaffinity, "sched_setaffinity"}, /* 243 */
+ { 3, 0, sys_sched_getaffinity, "sched_getaffinity"}, /* 244 */
+ { 5, TP, sys_waitid, "waitid" }, /* 245 */
+ { -1, 0, sys_restart_syscall, "restart_syscall"}, /* 246 */
+ { 5, TF, sys_pread, "pread64" }, /* 247 */
+ { 5, TF, sys_pwrite, "pwrite64" }, /* 248 */
+ { 3, 0, sys_mincore, "mincore" }, /* 249 */
+ { 3, 0, sys_madvise, "madvise" }, /* 250 */
+ { 4, 0, sys_readahead, "readahead" }, /* 251 */
+ { 5, TF, sys_setxattr, "setxattr" }, /* 252 */
+ { 5, TF, sys_setxattr, "lsetxattr" }, /* 253 */
+ { 5, 0, sys_fsetxattr, "fsetxattr" }, /* 254 */
+ { 4, TF, sys_getxattr, "getxattr" }, /* 255 */
+ { 4, TF, sys_getxattr, "lgetxattr" }, /* 256 */
+ { 4, TD, sys_fgetxattr, "fgetxattr" }, /* 257 */
+ { 3, TF, sys_listxattr, "listxattr" }, /* 258 */
+ { 3, TF, sys_listxattr, "llistxattr" }, /* 259 */
+ { 3, TD, sys_flistxattr, "flistxattr" }, /* 260 */
+ { 2, TF, sys_removexattr, "removexattr" }, /* 261 */
+ { 2, TF, sys_removexattr, "lremovexattr" }, /* 262 */
+ { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 263 */
+ { 2, TS, sys_kill, "tkill" }, /* 264 */
+ { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 265 */
+ { 6, 0, sys_futex, "futex" }, /* 266 */
+ { 2, 0, sys_io_setup, "io_setup" }, /* 267 */
+ { 1, 0, sys_io_destroy, "io_destroy" }, /* 268 */
+ { 5, 0, sys_io_getevents, "io_getevents" }, /* 269 */
+ { 3, 0, sys_io_submit, "io_submit" }, /* 270 */
+ { 3, 0, sys_io_cancel, "io_cancel" }, /* 271 */
+ { 4, 0, sys_fadvise64, "fadvise64" }, /* 272 */
+ { 1, TP, sys_exit, "exit_group" }, /* 273 */
+ { 1, TD, sys_epoll_create, "epoll_create" }, /* 274 */
+ { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 275 */
+ { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 276 */
+ { 5, 0, sys_remap_file_pages, "remap_file_pages"}, /* 277 */
+ { 1, 0, printargs, "set_tid_address"}, /* 278 */
+ { 3, TF, sys_fstatfs64, "fstatfs64" }, /* 279 */
+ { 3, TS, sys_tgkill, "tgkill" }, /* 280 */
+ { 2, TF, sys_utimes, "utimes" }, /* 281 */
+ { 6, 0, sys_fadvise64_64, "fadvise64_64" }, /* 282 */
+ { 6, 0, sys_mbind, "mbind" }, /* 283 */
+ { 5, 0, sys_get_mempolicy, "get_mempolicy" }, /* 284 */
+ { 3, 0, sys_set_mempolicy, "set_mempolicy" }, /* 285 */
+ { 5, 0, printargs, "kexec_load" }, /* 286 */
+ { 5, 0, printargs, "add_key" }, /* 287 */
+ { 4, 0, printargs, "request_key" }, /* 288 */
+ { 5, 0, printargs, "keyctl" }, /* 289 */
+ { 3, 0, printargs, "ioprio_set" }, /* 290 */
+ { 2, 0, printargs, "ioprio_get" }, /* 291 */
+ { 0, TD, printargs, "inotify_init" }, /* 292 */
+ { 3, TD, sys_inotify_add_watch, "inotify_add_watch"}, /* 293 */
+ { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch"}, /* 294 */
+ { 4, 0, printargs, "migrate_pages" }, /* 295 */
+ { 4, TD|TF, sys_openat, "openat" }, /* 296 */
+ { 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 297 */
+ { 4, TD|TF, sys_mknodat, "mknodat" }, /* 298 */
+ { 5, TD|TF, sys_fchownat, "fchownat" }, /* 299 */
+ { 3, TD|TF, sys_futimesat, "futimesat" }, /* 300 */
+ { 4, TD|TF, sys_newfstatat, "fstatat64" }, /* 301 */
+ { 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 302 */
+ { 4, TD|TF, sys_renameat, "renameat" }, /* 303 */
+ { 5, TD|TF, sys_linkat, "linkat" }, /* 304 */
+ { 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 305 */
+ { 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 306 */
+ { 3, TD|TF, sys_fchmodat, "fchmodat" }, /* 307 */
+ { 3, TD|TF, sys_faccessat, "faccessat" }, /* 308 */
+ { 6, TD, sys_pselect6, "pselect6" }, /* 309 */
+ { 5, TD, sys_ppoll, "ppoll" }, /* 310 */
+ { 1, TP, sys_unshare, "unshare" }, /* 311 */
+ { 2, 0, printargs, "set_robust_list"}, /* 312 */
+ { 3, 0, printargs, "get_robust_list"}, /* 313 */
+ { 6, TD, printargs, "splice" }, /* 314 */
+ { 4, TD, printargs, "sync_file_range"}, /* 315 */
+ { 4, TD, printargs, "tee" }, /* 316 */
+ { 4, TD, printargs, "vmsplice" }, /* 317 */
+ { 6, 0, sys_move_pages, "move_pages" }, /* 318 */
+ { 3, 0, sys_getcpu, "getcpu" }, /* 319 */
+ { 5, TD, sys_epoll_pwait, "epoll_pwait" }, /* 320 */
+ { 4, 0, sys_utimensat, "utimensat" }, /* 321 */
+ { 3, TD|TS, sys_signalfd, "signalfd" }, /* 322 */
+ { 2, TD, sys_timerfd_create, "timerfd_create"}, /* 323 */
+ { 1, TD, sys_eventfd, "eventfd" }, /* 324 */
+ { 6, TD, sys_fallocate, "fallocate" }, /* 325 */
+ { 4, TD, sys_timerfd_settime, "timerfd_settime"}, /* 326 */
+ { 2, TD, sys_timerfd_gettime, "timerfd_gettime"}, /* 327 */
+ { 4, TD|TS, sys_signalfd4, "signalfd4" }, /* 328 */
+ { 2, TD, sys_eventfd2, "eventfd2" }, /* 329 */
+ { 1, TD, sys_epoll_create1, "epoll_create1" }, /* 330 */
+ { 3, TD, sys_dup3, "dup3" }, /* 331 */
+ { 2, TD, sys_pipe2, "pipe2" }, /* 332 */
+ { 1, TD, sys_inotify_init1, "inotify_init1" }, /* 333 */
+ { 6, TD, printargs, "preadv" }, /* 334 */
+ { 6, TD, printargs, "pwritev" }, /* 335 */
+ { 3, TN, sys_socket, "socket" }, /* 336 */
+ { 3, TN, sys_bind, "bind" }, /* 337 */
+ { 3, TN, sys_connect, "connect" }, /* 338 */
+ { 2, TN, sys_listen, "listen" }, /* 339 */
+ { 3, TN, sys_accept, "accept" }, /* 340 */
+ { 3, TN, sys_getsockname, "getsockname" }, /* 341 */
+ { 3, TN, sys_getpeername, "getpeername" }, /* 342 */
+ { 4, TN, sys_socketpair, "socketpair" }, /* 343 */
+ { 4, TN, sys_send, "send" }, /* 344 */
+ { 6, TN, sys_sendto, "sendto" }, /* 345 */
+ { 4, TN, sys_recv, "recv" }, /* 346 */
+ { 6, TN, sys_recvfrom, "recvfrom" }, /* 347 */
+ { 2, TN, sys_shutdown, "shutdown" }, /* 348 */
+ { 5, TN, sys_setsockopt, "setsockopt" }, /* 349 */
+ { 5, TN, sys_getsockopt, "getsockopt" }, /* 350 */
+ { 5, TN, sys_sendmsg, "sendmsg" }, /* 351 */
+ { 5, TN, sys_recvmsg, "recvmsg" }, /* 352 */
+ { 1, 0, printargs, "arc_settls" }, /* 353 */
+ { 0, 0, printargs, "arc_gettls" }, /* 354 */
diff --git a/process.c b/process.c
index 6c1aa6b..6b21204 100644
--- a/process.c
+++ b/process.c
@@ -791,6 +791,11 @@ change_syscall(struct tcb *tcp, int new)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR(0)), new)<0)
return -1;
return 0;
+#elif defined(ARC)
+ /* Attempt to make vfork into fork, which we can follow. */
+ if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_r8), new) < 0)
+ return -1;
+ return 0;
#else
#warning Do not know how to handle change_syscall for this architecture
#endif /* architecture */
@@ -3080,6 +3085,20 @@ const struct xlat struct_user_offsets[] = {
{ PTREGS_OFFSET_FAULTNUM, "faultnum" },
{ PTREGS_OFFSET_ORIG_R0, "orig_r0" },
{ PTREGS_OFFSET_FLAGS, "flags" },
+# elif defined(ARC)
+ { PT_r0, "r0" },
+ { PT_r1, "r1" },
+ { PT_r2, "r2" },
+ { PT_r3, "r3" },
+ { PT_r4, "r4" },
+ { PT_r5, "r5" },
+ { PT_r6, "r6" },
+ { PT_r7, "r7" },
+ { PT_r8, "r8" },
+ { PT_r9, "r9" },
+ { PT_r10, "r10" },
+ { PT_r11, "r11" },
+ { PT_r12, "r12" },
# endif
# ifdef CRISV10
{ 4*PT_FRAMETYPE, "4*PT_FRAMETYPE" },
@@ -3194,7 +3213,7 @@ const struct xlat struct_user_offsets[] = {
# if !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) \
&& !defined(ALPHA) && !defined(IA64) \
&& !defined(CRISV10) && !defined(CRISV32) && !defined(MICROBLAZE)
-# if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(AVR32) && !defined(BFIN) && !defined(TILE)
+# if !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SPARC64) && !defined(AVR32) && !defined(BFIN) && !defined(TILE) && !defined(ARC)
{ uoff(u_fpvalid), "offsetof(struct user, u_fpvalid)" },
# endif
# if defined(I386) || defined(X86_64)
@@ -3216,13 +3235,13 @@ const struct xlat struct_user_offsets[] = {
{ uoff(start_stack), "offsetof(struct user, start_stack)" },
# endif
{ uoff(signal), "offsetof(struct user, signal)" },
-# if !defined(AVR32) && !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH) && !defined(SH64) && !defined(SPARC64) && !defined(TILE)
+# if !defined(AVR32) && !defined(S390) && !defined(S390X) && !defined(MIPS) && !defined(SH) && !defined(SH64) && !defined(SPARC64) && !defined(TILE) && !defined(ARC)
{ uoff(reserved), "offsetof(struct user, reserved)" },
# endif
# if !defined(SPARC64)
{ uoff(u_ar0), "offsetof(struct user, u_ar0)" },
# endif
-# if !defined(ARM) && !defined(AVR32) && !defined(MIPS) && !defined(S390) && !defined(S390X) && !defined(SPARC64) && !defined(BFIN) && !defined(TILE)
+# if !defined(ARM) && !defined(AVR32) && !defined(MIPS) && !defined(S390) && !defined(S390X) && !defined(SPARC64) && !defined(BFIN) && !defined(TILE) && !defined(ARC)
{ uoff(u_fpstate), "offsetof(struct user, u_fpstate)" },
# endif
{ uoff(magic), "offsetof(struct user, magic)" },
diff --git a/signal.c b/signal.c
index b47b831..97d6bb6 100644
--- a/signal.c
+++ b/signal.c
@@ -1584,6 +1584,33 @@ sys_sigreturn(struct tcb *tcp)
return RVAL_NONE | RVAL_STR;
}
return 0;
+
+#elif defined(ARC)
+ struct ucontext uc;
+ long sp;
+
+ if (entering(tcp)) {
+ tcp->u_arg[0] = 0;
+ if (upeek(tcp, PT_sp, &sp) < 0)
+ return 0;
+
+ /* our ucontext starts right at the sp */
+ if (umove(tcp, sp, &uc) < 0)
+ return 0;
+ tcp->u_arg[0] = 1;
+ memcpy(tcp->u_arg + 1, &uc.uc_sigmask, sizeof(uc.uc_sigmask));
+ }
+ else {
+ sigset_t sigm;
+
+ memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm));
+ tcp->u_rval = tcp->u_error = 0;
+ if (tcp->u_arg[0] == 0)
+ return 0;
+ tcp->auxstr = sprintsigmask("mask now ", &sigm, 0);
+ return RVAL_NONE | RVAL_STR;
+ }
+ return 0;
#else
#warning No sys_sigreturn() for this architecture
#warning (no problem, just a reminder :-)
diff --git a/syscall.c b/syscall.c
index e66ac0a..fb05769 100644
--- a/syscall.c
+++ b/syscall.c
@@ -1279,6 +1279,22 @@ get_scno(struct tcb *tcp)
# elif defined(MICROBLAZE)
if (upeek(tcp, 0, &scno) < 0)
return -1;
+# elif defined(ARC)
+ /* Get the syscall-num as we normally would, ignoring execve for now */
+ if (upeek(tcp, PT_r8, &scno) < 0)
+ return -1;
+
+ /* execve will wipe out the caller's pt_regs thus we need to fake
+ * the return value = 0
+ */
+ if (!(tcp->flags & TCB_INSYSCALL)) {
+ /* Check if we return from execve. */
+ if (tcp->flags & TCB_WAITEXECVE) {
+ tcp->flags &= ~TCB_WAITEXECVE;
+ return 0;
+ }
+ }
+
# endif
#endif /* LINUX */
@@ -1721,6 +1737,25 @@ get_error(struct tcb *tcp)
tcp->u_rval = r3;
u_error = 0;
}
+# elif defined(ARC)
+ int r0;
+ /* get the sya-call return value */
+ if (upeek(tcp, PT_r0, &r0) < 0)
+ return -1;
+
+ /* A signed -ve value doesn't rightaway mean error.
+ * some calls such as mmap can return high values which if treated
+ * as signed would look like errno. Make sure thats's not the case
+ */
+ if (check_errno && r0 < 0 && r0 > -nerrnos) {
+ tcp->u_rval = -1;
+ u_error = -r0;
+ }
+ else {
+ tcp->u_rval = r0;
+ u_error = 0;
+ }
+
# endif
#endif /* LINUX */
#ifdef SUNOS4
@@ -2284,6 +2319,20 @@ syscall_enter(struct tcb *tcp)
return -1;
}
}
+#elif defined(ARC)
+ {
+ int i;
+ int argreg[] = {PT_r0,PT_r1,PT_r2,PT_r3,PT_r4,PT_r5,PT_r6,PT_r7};
+
+ if (tcp->scno >= 0 && tcp->scno < nsyscalls && sysent[tcp->scno].nargs != -1)
+ tcp->u_nargs = sysent[tcp->scno].nargs;
+ else
+ tcp->u_nargs = sizeof(argreg) / sizeof(argreg[0]);
+
+ for (i = 0; i < tcp->u_nargs; ++i)
+ if (upeek(tcp, argreg[i], &tcp->u_arg[i]) < 0)
+ return -1;
+ }
#else /* Other architecture (like i386) (32bits specific) */
{
int i;
diff --git a/util.c b/util.c
index 711e614..3dfa69e 100644
--- a/util.c
+++ b/util.c
@@ -1218,6 +1218,16 @@ printcall(struct tcb *tcp)
return;
}
tprintf("[%08lx] ", pc);
+#elif defined(ARC)
+ /* Needed by strace -i to print the PC of syscall trap insn
+ */
+ long pc;
+
+ if (upeek(tcp, 4*41, &pc) < 0) {
+ PRINTBADPC;
+ return;
+ }
+ tprintf("[%08lx] ", pc);
# endif /* architecture */
#endif /* LINUX */
--
1.7.0.4
More information about the Strace-devel
mailing list