From 8f636ed12870cdc8e4b38194eb4b701f42ad222b Mon Sep 17 00:00:00 2001 From: Chris Zankel Date: Mon, 25 Mar 2013 10:22:07 -0700 Subject: [PATCH] Add support for the XTENSA architecture * configure.ac: Add XTENSA to the list of supported architectures. * defs.h: Add XTENSA support. * linux/xtensa/syscallent.h: New file. * linux/xtensa/ioctlent.h.in: Likewise. * process.c (struct_user_offsets): Add XTENSA support. * signal.c (sys_sigreturn): Likewise. * syscall.c (printcall, get_scno, get_syscall_args, get_syscall_result, get_error): Likewise. * util.c (change_syscall): Likewise. Signed-off-by: Chris Zankel --- configure.ac | 5 + defs.h | 1 + linux/xtensa/ioctlent.h.in | 1 + linux/xtensa/syscallent.h | 326 +++++++++++++++++++++++++++++++++++++ process.c | 94 +++++++++++ signal.c | 2 + syscall.c | 33 ++++ util.c | 3 + 8 files changed, 465 insertions(+) create mode 100644 linux/xtensa/ioctlent.h.in create mode 100644 linux/xtensa/syscallent.h diff --git a/configure.ac b/configure.ac index 2f813820..d545fd57 100644 --- a/configure.ac +++ b/configure.ac @@ -120,6 +120,11 @@ or1k*) AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.]) ;; +xtensa*) + arch=xtensa + AC_DEFINE([XTENSA], 1, [Define for the Xtensa 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 f47b8c7a..42ca88e0 100644 --- a/defs.h +++ b/defs.h @@ -140,6 +140,7 @@ extern char *stpcpy(char *dst, const char *src); || defined(OR1K) \ || defined(METAG) \ || defined(TILE) \ + || defined(XTENSA) \ ) && defined(__GLIBC__) # include #else diff --git a/linux/xtensa/ioctlent.h.in b/linux/xtensa/ioctlent.h.in new file mode 100644 index 00000000..a9eae81f --- /dev/null +++ b/linux/xtensa/ioctlent.h.in @@ -0,0 +1 @@ +/* intentionally empty */ diff --git a/linux/xtensa/syscallent.h b/linux/xtensa/syscallent.h new file mode 100644 index 00000000..4314ae4f --- /dev/null +++ b/linux/xtensa/syscallent.h @@ -0,0 +1,326 @@ + { 0, 0, printargs, "spill" }, /* 0 */ + { 0, 0, printargs, "xtensa" }, /* 1 */ + [2 ... 7] = { }, + { 3, TF, sys_open, "open" }, /* 8 */ + { 1, 0, sys_close, "close" }, /* 9 */ + { 1, 0, sys_dup, "dup" }, /* 10 */ + { 2, 0, sys_dup2, "dup2" }, /* 11 */ + { 3, TF, sys_read, "read" }, /* 12 */ + { 3, TF, sys_write, "write" }, /* 13 */ + { 5, 0, sys_select, "select" }, /* 14 */ + { 3, TD, sys_lseek, "lseek" }, /* 15 */ + { 3, 0, sys_poll, "poll" }, /* 16 */ + { 5, TD, sys_llseek, "_llseek" }, /* 17 */ + { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 18 */ + { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 19 */ + { 1, TD, sys_epoll_create, "epoll_create" }, /* 20 */ + { 2, TF, sys_creat, "creat" }, /* 21 */ + { 2, TF, sys_truncate, "truncate" }, /* 22 */ + { 2, TD, sys_ftruncate, "ftruncate" }, /* 23 */ + { 3, 0, sys_readv, "readv" }, /* 24 */ + { 3, 0, sys_writev, "writev" }, /* 25 */ + { 1, 0, sys_fsync, "fsync" }, /* 26 */ + { 1, 0, sys_fdatasync, "fdatasync" }, /* 27 */ + { 2, TF, sys_truncate64, "truncate64" }, /* 28 */ + { 2, TD, sys_ftruncate64, "ftruncate64" }, /* 29 */ + { 6, TD|TF, sys_pread, "pread64" }, /* 30 */ + { 6, TD|TF, sys_pwrite, "pwrite64" }, /* 31 */ + { 2, TF, sys_link, "link" }, /* 32 */ + { 2, TF, sys_rename, "rename" }, /* 33 */ + { 2, TF, sys_symlink, "symlink" }, /* 34 */ + { 3, TF, sys_readlink, "readlink" }, /* 35 */ + { 3, TF, sys_mknod, "mknod" }, /* 36 */ + { 1, 0, sys_pipe, "pipe" }, /* 37 */ + { 1, TF, sys_unlink, "unlink" }, /* 38 */ + { 1, TF, sys_rmdir, "rmdir" }, /* 39 */ + { 2, TF, sys_mkdir, "mkdir" }, /* 40 */ + { 1, TF, sys_chdir, "chdir" }, /* 41 */ + { 1, 0, sys_fchdir, "fchdir" }, /* 42 */ + { 2, TF, sys_getcwd, "getcwd" }, /* 43 */ + { 2, TF, sys_chmod, "chmod" }, /* 44 */ + { 3, TF, sys_chown, "chown" }, /* 45 */ + { 2, TF, sys_stat, "stat" }, /* 46 */ + { 2, TF, sys_stat64, "stat64" }, /* 47 */ + { 3, TF, sys_chown, "lchown" }, /* 48 */ + { 2, TF, sys_lstat, "lstat" }, /* 49 */ + { 2, TF, sys_lstat64, "lstat64" }, /* 50 */ + [51] = { }, + { 2, 0, sys_fchmod, "fchmod" }, /* 52 */ + { 3, 0, sys_fchown, "fchown" }, /* 53 */ + { 2, TD, sys_fstat, "fstat" }, /* 54 */ + { 2, TD, sys_fstat64, "fstat64" }, /* 55 */ + { 2, 0, sys_flock, "flock" }, /* 56 */ + { 2, TF, sys_access, "access" }, /* 57 */ + { 1, 0, sys_umask, "umask" }, /* 58 */ + { 3, 0, sys_getdents, "getdents" }, /* 59 */ + { 3, 0, sys_getdents64, "getdents64" }, /* 60 */ + { 3, 0, sys_fcntl, "fcntl64" }, /* 61 */ + { 6, 0, sys_fallocate, "fallocate" }, /* 62 */ + { 6, TD, sys_fadvise64_64, "fadvise64_64" }, /* 63 */ + { 2, TD, sys_utime, "utime" }, /* 64 */ + { 2, TF, sys_utimes, "utimes" }, /* 65 */ + { 3, 0, sys_ioctl, "ioctl" }, /* 66 */ + { 3, 0, sys_fcntl, "fcntl" }, /* 67 */ + { 5, TF, sys_setxattr, "setxattr" }, /* 68 */ + { 4, TF, sys_getxattr, "getxattr" }, /* 69 */ + { 3, TF, sys_listxattr, "listxattr" }, /* 70 */ + { 2, TF, sys_removexattr, "removexattr" }, /* 71 */ + { 5, TF, sys_setxattr, "lsetxattr" }, /* 72 */ + { 4, TF, sys_getxattr, "lgetxattr" }, /* 73 */ + { 3, TF, sys_listxattr, "llistxattr" }, /* 74 */ + { 2, TF, sys_removexattr, "lremovexattr" }, /* 75 */ + { 5, 0, sys_fsetxattr, "fsetxattr" }, /* 76 */ + { 4, TD, sys_fgetxattr, "fgetxattr" }, /* 77 */ + { 3, TD, sys_flistxattr, "flistxattr" }, /* 78 */ + { 2, TD, sys_fremovexattr, "fremovexattr" }, /* 79 */ + { 6, TD|TM, sys_mmap_pgoff, "mmap2" }, /* 80 */ + { 2, TM, sys_munmap, "munmap" }, /* 81 */ + { 3, TM, sys_mprotect, "mprotect" }, /* 82 */ + { 1, TM, sys_brk, "brk" }, /* 83 */ + { 2, TM, sys_mlock, "mlock" }, /* 84 */ + { 2, TM, sys_munlock, "munlock" }, /* 85 */ + { 1, TM, sys_mlockall, "mlockall" }, /* 86 */ + { 0, TM, sys_munlockall, "munlockall" }, /* 87 */ + { 4, TM, sys_mremap, "mremap" }, /* 88 */ + { 3, TM, sys_msync, "msync" }, /* 89 */ + { 3, TM, sys_mincore, "mincore" }, /* 90 */ + { 3, TM, sys_madvise, "madvise" }, /* 91 */ + { 4, TI, sys_shmget, "shmget" }, /* 92 */ + { 4, TI, sys_shmat, "shmat" }, /* 93 */ + { 4, TI, sys_shmctl, "shmctl" }, /* 94 */ + { 4, TI, sys_shmdt, "shmdt" }, /* 95 */ + { 3, TN, sys_socket, "socket" }, /* 96 */ + { 5, TN, sys_setsockopt, "setsockopt" }, /* 97 */ + { 5, TN, sys_getsockopt, "getsockopt" }, /* 98 */ + { 2, TN, sys_shutdown, "shutdown" }, /* 99 */ + { 3, TN, sys_bind, "bind" }, /* 100 */ + { 3, TN, sys_connect, "connect" }, /* 101 */ + { 2, TN, sys_listen, "listen" }, /* 102 */ + { 3, TN, sys_accept, "accept" }, /* 103 */ + { 3, TN, sys_getsockname, "getsockname" }, /* 104 */ + { 3, TN, sys_getpeername, "getpeername" }, /* 105 */ + { 3, TN, sys_sendmsg, "sendmsg" }, /* 106 */ + { 3, TN, sys_recvmsg, "recvmsg" }, /* 107 */ + { 4, TN, sys_send, "send" }, /* 108 */ + { 4, TN, sys_recv, "recv" }, /* 109 */ + { 6, TN, sys_sendto, "sendto" }, /* 110 */ + { 6, TN, sys_recvfrom, "recvfrom" }, /* 111 */ + { 4, TN, sys_socketpair, "socketpair" }, /* 112 */ + { 4, TD|TN, sys_sendfile, "sendfile" }, /* 113 */ + { 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 114 */ + { 4, TN, sys_sendmsg, "sendmsg" }, /* 115 */ + { 5, TP, sys_clone, "clone" }, /* 116 */ + { 3, TF|TP, sys_execve, "execve" }, /* 117 */ + { 1, TP, sys_exit, "exit" }, /* 118 */ + { 1, TP, sys_exit, "exit_group" }, /* 119 */ + { 0, 0, sys_getpid, "getpid" }, /* 120 */ + { 4, TP, sys_wait4, "wait4" }, /* 121 */ + { 5, TP, sys_waitid, "waitid" }, /* 122 */ + { 2, TS, sys_kill, "kill" }, /* 123 */ + { 2, TS, sys_kill, "tkill" }, /* 124 */ + { 3, TS, sys_tgkill, "tgkill" }, /* 125 */ + { 1, 0, printargs, "set_tid_address"}, /* 126 */ + { 0, 0, printargs, "gettid" }, /* 127 */ + { 0, 0, sys_setsid, "setsid" }, /* 128 */ + { 1, 0, sys_getsid, "getsid" }, /* 129 */ + { 5, 0, sys_prctl, "prctl" }, /* 130 */ + { 1, 0, sys_personality, "personality" }, /* 131 */ + { 2, 0, sys_getpriority, "getpriority" }, /* 132 */ + { 3, 0, sys_setpriority, "setpriority" }, /* 133 */ + { 3, 0, sys_setitimer, "setitimer" }, /* 134 */ + { 2, 0, sys_getitimer, "getitimer" }, /* 135 */ + { 1, NF, sys_setuid, "setuid" }, /* 136 */ + { 0, NF, sys_getuid, "getuid" }, /* 137 */ + { 1, 0, sys_setgid, "setgid" }, /* 138 */ + { 0, NF, sys_getgid, "getgid" }, /* 139 */ + { 0, NF, sys_geteuid, "geteuid" }, /* 140 */ + { 0, NF, sys_getegid, "getegid" }, /* 141 */ + { 2, 0, sys_setreuid, "setreuid" }, /* 142 */ + { 2, 0, sys_setregid, "setregid" }, /* 143 */ + { 3, 0, sys_setresuid, "setresuid" }, /* 144 */ + { 3, 0, sys_getresuid, "getresuid" }, /* 145 */ + { 3, 0, sys_setresgid, "setresgid" }, /* 146 */ + { 3, 0, sys_getresgid, "getresgid" }, /* 147 */ + { 2, 0, sys_setpgid, "setpgid" }, /* 148 */ + { 1, 0, sys_getpgid, "getpgid" }, /* 149 */ + { 0, 0, sys_getppid, "getppid" }, /* 150 */ + { 0, 0, sys_getpgrp, "getpgrp" }, /* 151 */ + [152 ... 153] = { }, + { 1, TF, sys_times, "times" }, /* 154 */ + { 1, TF, sys_acct, "acct" }, /* 155 */ + { 3, 0, sys_sched_setaffinity, "sched_setaffinity"}, /* 156 */ + { 3, 0, sys_sched_getaffinity, "sched_getaffinity"}, /* 157 */ + { 2, 0, sys_capget, "capget" }, /* 158 */ + { 2, 0, sys_capset, "capset" }, /* 159 */ + { 4, 0, sys_ptrace, "ptrace" }, /* 160 */ + { 5, TI, sys_semtimedop, "semtimedop" }, /* 161 */ + { 4, TI, sys_semget, "semget" }, /* 162 */ + { 4, TI, sys_semop, "semop" }, /* 163 */ + { 4, TI, sys_semctl, "semctl" }, /* 164 */ + [165] = { }, + { 4, TI, sys_msgget, "msgget" }, /* 166 */ + { 4, TI, sys_msgsnd, "msgsnd" }, /* 167 */ + { 4, TI, sys_msgrcv, "msgrcv" }, /* 168 */ + { 4, TI, sys_msgctl, "msgctl" }, /* 169 */ + [170] = { }, + { 2, TF, sys_umount2, "umount2" }, /* 171 */ + { 5, TF, sys_mount, "mount" }, /* 172 */ + { 2, TF, sys_swapon, "swapon" }, /* 173 */ + { 1, TF, sys_chroot, "chroot" }, /* 174 */ + { 2, 0, sys_pivotroot, "pivot_root" }, /* 175 */ + { 2, TF, sys_umount, "umount" }, /* 176 */ + { 1, 0, sys_swapoff, "swapoff" }, /* 177 */ + { 0, 0, sys_sync, "sync" }, /* 178 */ + [179] = { }, + { 1, 0, sys_setfsuid, "setfsuid" }, /* 180 */ + { 1, 0, sys_setfsgid, "setfsgid" }, /* 181 */ + { 3, 0, sys_sysfs, "sysfs" }, /* 182 */ + { 2, 0, sys_ustat, "ustat" }, /* 183 */ + { 2, TF, sys_statfs, "statfs" }, /* 184 */ + { 2, TF, sys_fstatfs, "fstatfs" }, /* 185 */ + { 3, TF, sys_statfs64, "statfs64" }, /* 186 */ + { 3, TF, sys_fstatfs64, "fstatfs64" }, /* 187 */ + { 2, 0, sys_setrlimit, "setrlimit" }, /* 188 */ + { 2, 0, sys_getrlimit, "getrlimit" }, /* 189 */ + { 2, 0, sys_getrusage, "getrusage" }, /* 190 */ + { 5, 0, sys_futex, "futex" }, /* 191 */ + { 2, 0, sys_gettimeofday, "gettimeofday" }, /* 192 */ + { 2, 0, sys_settimeofday, "settimeofday" }, /* 193 */ + { 1, 0, sys_adjtimex, "adjtimex" }, /* 194 */ + { 2, 0, sys_nanosleep, "nanosleep" }, /* 195 */ + { 2, 0, sys_getgroups, "getgroups" }, /* 196 */ + { 2, 0, sys_setgroups, "setgroups" }, /* 197 */ + { 2, 0, sys_sethostname, "sethostname" }, /* 198 */ + { 2, 0, sys_setdomainname, "setdomainname" }, /* 199 */ + { 3, 0, sys_syslog, "syslog" }, /* 200 */ + { 0, 0, sys_vhangup, "vhangup" }, /* 201 */ + { 1, TF, sys_uselib, "uselib" }, /* 202 */ + { 3, 0, sys_reboot, "reboot" }, /* 203 */ + { 4, TF, sys_quotactl, "quotactl" }, /* 204 */ + { 0, 0, printargs, "nfsservctl" }, /* 205 */ + { 1, 0, sys_sysctl, "_sysctl" }, /* 206 */ + { 2, 0, sys_bdflush, "bdflush" }, /* 207 */ + { 1, 0, sys_uname, "uname" }, /* 208 */ + { 1, 0, sys_sysinfo, "sysinfo" }, /* 209 */ + { 2, 0, sys_init_module, "init_module" }, /* 210 */ + { 1, 0, sys_delete_module, "delete_module" }, /* 211 */ + { 2, 0, sys_sched_setparam, "sched_setparam"}, /* 212 */ + { 2, 0, sys_sched_getparam, "sched_getparam"}, /* 213 */ + { 3, 0, sys_sched_setscheduler, "sched_setscheduler"}, /* 214 */ + { 1, 0, sys_sched_getscheduler, "sched_getscheduler"}, /* 215 */ + { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"}, /* 216 */ + { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"}, /* 217 */ + { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval"}, /* 218 */ + { 0, 0, sys_sched_yield, "sched_yield" }, /* 219 */ + [220 ... 222] = { }, + { 0, 0, printargs, "restart_syscall"}, /* 223 */ + { 2, TS, sys_sigaltstack, "sigaltstack" }, /* 224 */ + { 1, 0, sys_rt_sigreturn, "rt_sigreturn" }, /* 225 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 226 */ + { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 227 */ + { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 228 */ + { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 229 */ + { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"}, /* 230 */ + { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 231 */ + { 4, 0, sys_mq_open, "mq_open" }, /* 232 */ + { 1, 0, sys_mq_unlink, "mq_unlink" }, /* 233 */ + { 5, 0, sys_mq_timedsend, "mq_timedsend" }, /* 234 */ + { 5, 0, sys_mq_timedreceive, "mq_timedreceive"}, /* 235 */ + { 2, 0, sys_mq_notify, "mq_notify" }, /* 236 */ + { 3, 0, sys_mq_getsetattr, "mq_getsetattr" }, /* 237 */ + [238] = { }, + { 2, 0, printargs, "io_setup" }, /* 239 */ + { 1, 0, printargs, "io_destroy" }, /* 240 */ + { 3, 0, printargs, "io_submit" }, /* 241 */ + { 5, 0, printargs, "io_getevents" }, /* 242 */ + { 3, 0, printargs, "io_cancel" }, /* 243 */ + { 2, 0, sys_clock_settime, "clock_settime" }, /* 244 */ + { 2, 0, sys_clock_gettime, "clock_gettime" }, /* 245 */ + { 2, 0, sys_clock_getres, "clock_getres" }, /* 246 */ + { 4, 0, sys_clock_nanosleep, "clock_nanosleep"}, /* 247 */ + { 3, 0, sys_timer_create, "timer_create" }, /* 248 */ + { 1, 0, sys_timer_delete, "timer_delete" }, /* 249 */ + { 4, 0, sys_timer_settime, "timer_settime" }, /* 250 */ + { 2, 0, sys_timer_gettime, "timer_gettime" }, /* 251 */ + { 1, 0, sys_timer_getoverrun, "timer_getoverrun"}, /* 252 */ + [253] = { }, + { 4, 0, printargs, "lookup_dcookie"}, /* 254 */ + [255] = { }, + { 5, 0, printargs, "add_key" }, /* 256 */ + { 5, 0, printargs, "request_key" }, /* 257 */ + { 5, 0, printargs, "keyctl" }, /* 258 */ + [259] = { }, + { 4, 0, sys_readahead, "readahead" }, /* 260 */ + { 5, TM, sys_remap_file_pages, "remap_file_pages"}, /* 261 */ + { 5, TM, sys_migrate_pages, "migrate_pages" }, /* 262 */ + { 0, TM, sys_mbind, "mbind" }, /* 263 */ + { 6, TM, sys_get_mempolicy, "get_mempolicy" }, /* 264 */ + { 5, TM, sys_set_mempolicy, "set_mempolicy" }, /* 265 */ + { 3, TP, sys_unshare, "unshare" }, /* 266 */ + { 1, TM, sys_move_pages, "move_pages" }, /* 267 */ + { 0, TD, sys_splice, "splice" }, /* 268 */ + { 0, TD, sys_tee, "tee" }, /* 269 */ + { 0, TD, sys_vmsplice, "vmsplice" }, /* 270 */ + { 0, 0, printargs, "SYS_271" }, /* 271 */ + { 0, TD, sys_pselect6, "pselect6" }, /* 272 */ + { 0, TD, sys_ppoll, "ppoll" }, /* 273 */ + { 0, TD, sys_epoll_pwait, "epoll_pwait" }, /* 274 */ + { 1, TD, sys_epoll_create1, "epoll_create1" }, /* 275 */ + { 0, TD, sys_inotify_init, "inotify_init" }, /* 276 */ + { 3, TD, sys_inotify_add_watch, "inotify_add_watch"}, /* 277 */ + { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch"}, /* 278 */ + { 1, TD, sys_inotify_init1, "inotify_init1" }, /* 279 */ + { 0, 0, sys_getcpu, "getcpu" }, /* 280 */ + { 4, 0, sys_kexec_load, "kexec_load" }, /* 281 */ + { 2, 0, sys_ioprio_set, "ioprio_set" }, /* 282 */ + { 3, 0, sys_ioprio_get, "ioprio_get" }, /* 283 */ + { 3, 0, sys_set_robust_list, "set_robust_list"}, /* 284 */ + { 3, 0, sys_get_robust_list, "get_robust_list"}, /* 285 */ + { 0, 0, printargs, "SYS_286" }, /* 286 */ + { 0, 0, printargs, "SYS_287" }, /* 287 */ + { 4, TD|TF, sys_openat, "openat" }, /* 288 */ + { 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 289 */ + { 4, TD|TF, sys_mknodat, "mknodat" }, /* 290 */ + { 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 291 */ + { 4, TD|TF, sys_renameat, "renameat" }, /* 292 */ + { 5, TD|TF, sys_linkat, "linkat" }, /* 293 */ + { 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 294 */ + { 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 295 */ + { 0, TD|TF, sys_utimensat, "utimensat" }, /* 296 */ + { 5, TD|TF, sys_fchownat, "fchownat" }, /* 297 */ + { 4, TD|TF, sys_futimesat, "futimesat" }, /* 298 */ + { 0, TD|TF, sys_newfstatat, "fstatat64" }, /* 299 */ + { 4, TD|TF, sys_fchmodat, "fchmodat" }, /* 300 */ + { 4, TD|TF, sys_faccessat, "faccessat" }, /* 301 */ + { 0, 0, printargs, "SYS_302" }, /* 302 */ + { 0, 0, printargs, "SYS_303" }, /* 303 */ + { 3, TD|TS, sys_signalfd, "signalfd" }, /* 304 */ + { 0, 0, printargs, "SYS_305" }, /* 305 */ + { 1, TD, sys_eventfd, "eventfd" }, /* 306 */ + { 5, TN, sys_recvmmsg, "recvmmsg" }, /* 307 */ + { 2, TD, sys_setns, "setns" }, /* 308 */ + { 4, TD|TS, sys_signalfd4, "signalfd4" }, /* 309 */ + { 3, TD, sys_dup3, "dup3" }, /* 310 */ + { 2, TD, sys_pipe2, "pipe2" }, /* 311 */ + { 2, TD, sys_timerfd_create, "timerfd_create"}, /* 312 */ + { 4, TD, sys_timerfd_settime, "timerfd_settime"}, /* 313 */ + { 2, TD, sys_timerfd_gettime, "timerfd_gettime"}, /* 314 */ + { 0, 0, printargs, "SYS_315" }, /* 315 */ + { 2, TD, sys_eventfd2, "eventfd2" }, /* 316 */ + { 5, TD, sys_preadv, "preadv" }, /* 317 */ + { 5, TD, sys_pwritev, "pwritev" }, /* 318 */ + [319] = { }, + { 2, TD, sys_fanotify_init, "fanotify_init" }, /* 320 */ + { 6, TD|TF, sys_fanotify_mark, "fanotify_mark" }, /* 321 */ + { 6, 0, sys_process_vm_readv, "process_vm_readv"}, /* 322 */ + { 6, 0, sys_process_vm_writev, "process_vm_writev"}, /* 323 */ + { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at"}, /* 324 */ + { 3, TD, sys_open_by_handle_at, "open_by_handle_at"}, /* 325 */ + { 6, TD, sys_sync_file_range, "sync_file_range"}, /* 326 */ + { 5, TD, sys_perf_event_open, "perf_event_open"}, /* 327 */ + { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo"}, /* 328 */ + { 2, 0, sys_clock_adjtime, "clock_adjtime" }, /* 329 */ + { 4, 0, sys_prlimit64, "prlimit64" }, /* 330 */ + { 5, TP, printargs, "kcmp" }, /* 331 */ + { 3, TP, printargs, "finit_module" }, /* 332 */ + { 4, TN, sys_accept4, "accept4" }, /* 333 */ diff --git a/process.c b/process.c index 9bc78d6c..de88c937 100644 --- a/process.c +++ b/process.c @@ -2220,6 +2220,98 @@ const struct xlat struct_user_offsets[] = { { 4*32, "pc" }, { 4*33, "sr" }, #endif +#ifdef XTENSA + { SYSCALL_NR, "syscall_nr" }, + { REG_AR_BASE, "ar0" }, + { REG_AR_BASE+1, "ar1" }, + { REG_AR_BASE+2, "ar2" }, + { REG_AR_BASE+3, "ar3" }, + { REG_AR_BASE+4, "ar4" }, + { REG_AR_BASE+5, "ar5" }, + { REG_AR_BASE+6, "ar6" }, + { REG_AR_BASE+7, "ar7" }, + { REG_AR_BASE+8, "ar8" }, + { REG_AR_BASE+9, "ar9" }, + { REG_AR_BASE+10, "ar10" }, + { REG_AR_BASE+11, "ar11" }, + { REG_AR_BASE+12, "ar12" }, + { REG_AR_BASE+13, "ar13" }, + { REG_AR_BASE+14, "ar14" }, + { REG_AR_BASE+15, "ar15" }, + { REG_AR_BASE+16, "ar16" }, + { REG_AR_BASE+17, "ar17" }, + { REG_AR_BASE+18, "ar18" }, + { REG_AR_BASE+19, "ar19" }, + { REG_AR_BASE+20, "ar20" }, + { REG_AR_BASE+21, "ar21" }, + { REG_AR_BASE+22, "ar22" }, + { REG_AR_BASE+23, "ar23" }, + { REG_AR_BASE+24, "ar24" }, + { REG_AR_BASE+25, "ar25" }, + { REG_AR_BASE+26, "ar26" }, + { REG_AR_BASE+27, "ar27" }, + { REG_AR_BASE+28, "ar28" }, + { REG_AR_BASE+29, "ar29" }, + { REG_AR_BASE+30, "ar30" }, + { REG_AR_BASE+31, "ar31" }, + { REG_AR_BASE+32, "ar32" }, + { REG_AR_BASE+33, "ar33" }, + { REG_AR_BASE+34, "ar34" }, + { REG_AR_BASE+35, "ar35" }, + { REG_AR_BASE+36, "ar36" }, + { REG_AR_BASE+37, "ar37" }, + { REG_AR_BASE+38, "ar38" }, + { REG_AR_BASE+39, "ar39" }, + { REG_AR_BASE+40, "ar40" }, + { REG_AR_BASE+41, "ar41" }, + { REG_AR_BASE+42, "ar42" }, + { REG_AR_BASE+43, "ar43" }, + { REG_AR_BASE+44, "ar44" }, + { REG_AR_BASE+45, "ar45" }, + { REG_AR_BASE+46, "ar46" }, + { REG_AR_BASE+47, "ar47" }, + { REG_AR_BASE+48, "ar48" }, + { REG_AR_BASE+49, "ar49" }, + { REG_AR_BASE+50, "ar50" }, + { REG_AR_BASE+51, "ar51" }, + { REG_AR_BASE+52, "ar52" }, + { REG_AR_BASE+53, "ar53" }, + { REG_AR_BASE+54, "ar54" }, + { REG_AR_BASE+55, "ar55" }, + { REG_AR_BASE+56, "ar56" }, + { REG_AR_BASE+57, "ar57" }, + { REG_AR_BASE+58, "ar58" }, + { REG_AR_BASE+59, "ar59" }, + { REG_AR_BASE+60, "ar60" }, + { REG_AR_BASE+61, "ar61" }, + { REG_AR_BASE+62, "ar62" }, + { REG_AR_BASE+63, "ar63" }, + { REG_LBEG, "lbeg" }, + { REG_LEND, "lend" }, + { REG_LCOUNT, "lcount" }, + { REG_SAR, "sar" }, + { REG_WB, "wb" }, + { REG_WS, "ws" }, + { REG_PS, "ps" }, + { REG_PC, "pc" }, + { REG_A_BASE, "a0" }, + { REG_A_BASE+1, "a1" }, + { REG_A_BASE+2, "a2" }, + { REG_A_BASE+3, "a3" }, + { REG_A_BASE+4, "a4" }, + { REG_A_BASE+5, "a5" }, + { REG_A_BASE+6, "a6" }, + { REG_A_BASE+7, "a7" }, + { REG_A_BASE+8, "a8" }, + { REG_A_BASE+9, "a9" }, + { REG_A_BASE+10, "a10" }, + { REG_A_BASE+11, "a11" }, + { REG_A_BASE+12, "a12" }, + { REG_A_BASE+13, "a13" }, + { REG_A_BASE+14, "a14" }, + { REG_A_BASE+15, "a15" }, +#endif + /* Other fields in "struct user" */ #if defined(S390) || defined(S390X) { uoff(u_tsize), "offsetof(struct user, u_tsize)" }, @@ -2355,6 +2447,8 @@ const struct xlat struct_user_offsets[] = { /* nothing */ #elif defined(METAG) /* nothing */ +#elif defined(XTENSA) + /* nothing */ #endif { 0, NULL }, }; diff --git a/signal.c b/signal.c index 8873c744..cc1d511d 100644 --- a/signal.c +++ b/signal.c @@ -994,6 +994,8 @@ sys_sigreturn(struct tcb *tcp) } #elif defined(X86_64) /* no need to remind */ +#elif defined(XTENSA) + /* Xtensa only has rt_sys_sigreturn */ #else # warning No sys_sigreturn() for this architecture # warning (no problem, just a reminder :-) diff --git a/syscall.c b/syscall.c index ceddc5d3..833dacd3 100644 --- a/syscall.c +++ b/syscall.c @@ -76,6 +76,10 @@ # include #endif +#if defined(XTENSA) +# include +#endif + #ifndef ERESTARTSYS # define ERESTARTSYS 512 #endif @@ -799,6 +803,8 @@ static struct user_regs_struct or1k_regs; #elif defined(METAG) static struct user_gp_regs metag_regs; # define ARCH_REGS_FOR_GETREGSET metag_regs +#elif defined(XTENSA) +static long xtensa_a2; #endif void @@ -936,6 +942,13 @@ printcall(struct tcb *tcp) tprintf("[%08lx] ", or1k_regs.pc); #elif defined(METAG) tprintf("[%08lx] ", metag_regs.pc); +#elif defined(XTENSA) + long pc; + if (upeek(tcp, REG_PC, &pc) < 0) { + PRINTBADPC; + return; + } + tprintf("[%08lx] ", pc); #endif /* architecture */ } @@ -1516,6 +1529,9 @@ get_scno(struct tcb *tcp) scno = or1k_regs.gpr[11]; #elif defined(METAG) scno = metag_regs.dx[0][1]; /* syscall number in D1Re0 (D1.0) */ +#elif defined(XTENSA) + if (upeek(tcp, SYSCALL_NR, &scno) < 0) + return -1; #endif tcp->scno = scno; @@ -1916,6 +1932,12 @@ get_syscall_args(struct tcb *tcp) for (i = 0; i < nargs; i++) /* arguments go backwards from D1Ar1 (D1.3) */ tcp->u_arg[i] = ((unsigned long *)&metag_regs.dx[3][1])[-i]; +#elif defined(XTENSA) + /* arg0: a6, arg1: a3, arg2: a4, arg3: a5, arg4: a8, arg5: a9 */ + static const int xtensaregs[MAX_ARGS] = { 6, 3, 4, 5, 8, 9 }; + for (i = 0; i < nargs; ++i) + if (upeek(tcp, REG_A_BASE + xtensaregs[i], &tcp->u_arg[i]) < 0) + return -1; #else /* Other architecture (32bits specific) */ for (i = 0; i < nargs; ++i) if (upeek(tcp, i*4, &tcp->u_arg[i]) < 0) @@ -2112,6 +2134,9 @@ get_syscall_result(struct tcb *tcp) /* already done by get_regs */ #elif defined(METAG) /* already done by get_regs */ +#elif defined(XTENSA) + if (upeek(tcp, REG_A_BASE + 2, &xtensa_a2) < 0) + return -1; #endif return 1; } @@ -2411,6 +2436,14 @@ get_error(struct tcb *tcp) else { tcp->u_rval = or1k_regs.gpr[11]; } +#elif defined(XTENSA) + if (check_errno && is_negated_errno(xtensa_a2)) { + tcp->u_rval = -1; + u_error = -xtensa_a2; + } + else { + tcp->u_rval = xtensa_a2; + } #endif tcp->u_error = u_error; } diff --git a/util.c b/util.c index 84ab00eb..fa552cc2 100644 --- a/util.c +++ b/util.c @@ -1401,6 +1401,9 @@ change_syscall(struct tcb *tcp, arg_setup_state *state, int new) #elif defined(METAG) /* setbpt/clearbpt never used: */ /* Meta is only supported since linux-3.7 */ +#elif defined(XTENSA) + /* setbpt/clearbpt never used: */ + /* Xtensa is only supported since linux 2.6.13 */ #else #warning Do not know how to handle change_syscall for this architecture #endif /* architecture */ -- 2.40.0