Support for the OpenRISC 1000 platform.

Christian Svensson blue at cmd.nu
Tue Feb 12 11:52:21 UTC 2013


Updated patch. I also merged the secondary patch into this one.
I have come to realize that my email client wraps lines - until I am
able to fix that, I also attached the patch as an attachment.

    * configure.ac: Added or1k.
    * defs.h: Added or1k to use _regs system.
    * linux/or1k/ioctlent.h.in: Use i386 ioctls.
    * linux/or1k/syscallent.h: New.
    * process.c: Added or1k.
    * syscall.c: Added or1k handlers.
      (or1k_io) iovec for or1k GETREGSET.
      (or1k_regs) regset structure for or1k.
    * util.c: OR1K define to remove warning for change_syscall.
---
 configure.ac             |   5 +
 defs.h                   |   5 +-
 linux/or1k/ioctlent.h.in |   1 +
 linux/or1k/syscallent.h  | 260 +++++++++++++++++++++++++++++++++++++++++++++++
 process.c                |  41 +++++++-
 syscall.c                |  31 ++++++
 util.c                   |   2 +
 7 files changed, 341 insertions(+), 4 deletions(-)
 create mode 100644 linux/or1k/ioctlent.h.in
 create mode 100644 linux/or1k/syscallent.h

diff --git a/configure.ac b/configure.ac
index 80be383..8703f7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,6 +111,11 @@ microblaze*)
 	arch=microblaze
 	AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
 	;;
+or1k*)
+	arch=or1k
+	AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 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 9756179..a99010f 100644
--- a/defs.h
+++ b/defs.h
@@ -134,7 +134,8 @@ extern char *stpcpy(char *dst, const char *src);
 # define LINUX_MIPS64
 #endif

-#if (defined(LINUXSPARC) || defined(X86_64) || defined(ARM) ||
defined(AARCH64) || defined(AVR32)) && defined(__GLIBC__)
+#if (defined(LINUXSPARC) || defined(X86_64) || defined(ARM) ||
defined(AARCH64) \
+    || defined(OR1K) || defined(AVR32)) && defined(__GLIBC__)
 # include <sys/ptrace.h>
 #else
 /* Work around awkward prototype in ptrace.h. */
@@ -561,7 +562,7 @@ extern void call_summary(FILE *);
  || defined(AARCH64) \
  || defined(ARM) \
  || defined(SPARC) || defined(SPARC64) \
- || defined(TILE)
+ || defined(TILE) || defined(OR1K)
 extern long get_regs_error;
 # define clear_regs()  (get_regs_error = -1)
 extern void get_regs(pid_t pid);
diff --git a/linux/or1k/ioctlent.h.in b/linux/or1k/ioctlent.h.in
new file mode 100644
index 0000000..52ac99b
--- /dev/null
+++ b/linux/or1k/ioctlent.h.in
@@ -0,0 +1 @@
+#include "../i386/ioctlent.h.in"
diff --git a/linux/or1k/syscallent.h b/linux/or1k/syscallent.h
new file mode 100644
index 0000000..e2fe233
--- /dev/null
+++ b/linux/or1k/syscallent.h
@@ -0,0 +1,260 @@
+	{  2, 	0, 	sys_io_setup,			"io_setup"		}, /* 0 */
+	{  1, 	0, 	sys_io_destroy, 		"io_destroy"		}, /* 1 */
+	{  3, 	0, 	sys_io_submit, 			"io_submit"		}, /* 2 */
+	{  3, 	0, 	sys_io_cancel, 			"io_cancel"		}, /* 3 */
+	{  5, 	0, 	sys_io_getevents, 		"io_getevents"		}, /* 4 */
+	{  5, 	TF, 	sys_setxattr, 			"setxattr"		}, /* 5 */
+	{  5, 	TF, 	sys_setxattr, 			"lsetxattr"		}, /* 6 */
+	{  5, 	TD, 	sys_fsetxattr, 			"fsetxattr"		}, /* 7 */
+	{  4, 	TF, 	sys_getxattr, 			"getxattr"		}, /* 8 */
+	{  4, 	TF, 	sys_getxattr, 			"lgetxattr"		}, /* 9 */
+	{  4, 	TD, 	sys_fgetxattr, 			"fgetxattr"		}, /* 10 */
+	{  3, 	TF, 	sys_listxattr, 			"listxattr"		}, /* 11 */
+	{  3, 	TF, 	sys_listxattr, 			"llistxattr"		}, /* 12 */
+	{  3, 	TD, 	sys_flistxattr, 		"flistxattr"		}, /* 13 */
+	{  2, 	TF, 	sys_removexattr, 		"removexattr"		}, /* 14 */
+	{  2, 	TF, 	sys_removexattr, 		"lremovexattr"		}, /* 15 */
+	{  2, 	TD, 	sys_fremovexattr, 		"fremovexattr"		}, /* 16 */
+	{  2, 	TF, 	sys_getcwd, 			"getcwd"		}, /* 17 */
+	{  4, 	0, 	sys_lookup_dcookie, 		"lookup_dcookie"	}, /* 18 */
+	{  2, 	TD, 	sys_eventfd2, 			"eventfd2"		}, /* 19 */
+	{  1, 	TD, 	sys_epoll_create1, 		"epoll_create1"		}, /* 20 */
+	{  4, 	TD, 	sys_epoll_ctl, 			"epoll_ctl"		}, /* 21 */
+	{  6, 	TD, 	sys_epoll_pwait, 		"epoll_pwait"		}, /* 22 */
+	{  1, 	TD, 	sys_dup, 			"dup"			}, /* 23 */
+	{  3, 	TD, 	sys_dup3, 			"dup3"			}, /* 24 */
+	{  3, 	TD, 	sys_fcntl, 			"fcntl64"		}, /* 25 */
+	{  1, 	TD, 	sys_inotify_init1, 		"inotify_init1"		}, /* 26 */
+	{  3, 	TD, 	sys_inotify_add_watch, 		"inotify_add_watch"	}, /* 27 */
+	{  2, 	TD, 	sys_inotify_rm_watch, 		"inotify_rm_watch"	}, /* 28 */
+	{  3, 	TD, 	sys_ioctl, 			"ioctl"			}, /* 29 */
+	{  3, 	0, 	sys_ioprio_set, 		"ioprio_set"		}, /* 30 */
+	{  2, 	0, 	sys_ioprio_get, 		"ioprio_get"		}, /* 31 */
+	{  2, 	TD, 	sys_flock, 			"flock"			}, /* 32 */
+	{  4, 	TD|TF, 	sys_mknodat, 			"mknodat"		}, /* 33 */
+	{  3, 	TD|TF, 	sys_mkdirat, 			"mkdirat"		}, /* 34 */
+	{  3, 	TD|TF, 	sys_unlinkat, 			"unlinkat"		}, /* 35 */
+	{  3, 	TD|TF, 	sys_symlinkat, 			"symlinkat"		}, /* 36 */
+	{  5, 	TD|TF, 	sys_linkat, 			"linkat"		}, /* 37 */
+	{  4, 	TD|TF, 	sys_renameat, 			"renameat"		}, /* 38 */
+	{  2, 	TF, 	sys_umount2, 			"umount"		}, /* 39 */
+	{  5, 	TF, 	sys_mount, 			"mount"			}, /* 40 */
+	{  2, 	TF, 	sys_pivotroot, 			"pivot_root"		}, /* 41 */
+	{  3, 	0, 	sys_nfsservctl, 		"nfsservctl"		}, /* 42 */
+	{  3, 	TF, 	sys_statfs64, 			"statfs64"		}, /* 43 */
+	{  3, 	TD, 	sys_fstatfs64, 			"fstatfs64"		}, /* 44 */
+	{  4, 	TF, 	sys_truncate64, 		"truncate64"		}, /* 45 */
+	{  4, 	TD, 	sys_ftruncate64, 		"ftruncate64"		}, /* 46 */
+	{  6, 	TD, 	sys_fallocate, 			"fallocate"		}, /* 47 */
+	{  3, 	TD|TF, 	sys_faccessat, 			"faccessat"		}, /* 48 */
+	{  1, 	TF, 	sys_chdir, 			"chdir"			}, /* 49 */
+	{  1, 	TF, 	sys_fchdir, 			"fchdir"		}, /* 50 */
+	{  1, 	TF, 	sys_chroot, 			"chroot"		}, /* 51 */
+	{  2, 	TD, 	sys_fchmod, 			"fchmod"		}, /* 52 */
+	{  3, 	TD|TF, 	sys_fchmodat, 			"fchmodat"		}, /* 53 */
+	{  5, 	TD|TF, 	sys_fchownat, 			"fchownat"		}, /* 54 */
+	{  3, 	TD, 	sys_fchown, 			"fchown"		}, /* 55 */
+	{  4, 	TD|TF, 	sys_openat, 			"openat"		}, /* 56 */
+	{  1, 	TD, 	sys_close, 			"close"			}, /* 57 */
+	{  0, 	0, 	sys_vhangup, 			"vhangup"		}, /* 58 */
+	{  2, 	TD, 	sys_pipe2, 			"pipe2"			}, /* 59 */
+	{  4, 	0, 	sys_quotactl, 			"quotactl"		}, /* 60 */
+	{  3, 	TD, 	sys_getdents64, 		"getdents64"		}, /* 61 */
+	{  5, 	TF, 	sys_llseek, 			"_llseek"		}, /* 62 */
+	{  3, 	TD, 	sys_read, 			"read"			}, /* 63 */
+	{  3, 	TD, 	sys_write, 			"write"			}, /* 64 */
+	{  3, 	TD, 	sys_readv, 			"readv"			}, /* 65 */
+	{  3, 	TD, 	sys_writev, 			"writev"		}, /* 66 */
+	{  6, 	TD, 	sys_pread, 			"pread64"		}, /* 67 */
+	{  6, 	TD, 	sys_pwrite, 			"pwrite64"		}, /* 68 */
+	{  5, 	TD, 	sys_preadv, 			"preadv"		}, /* 69 */
+	{  5, 	TD, 	sys_pwritev, 			"pwritev"		}, /* 70 */
+	{  4, 	TD|TN, 	sys_sendfile64, 		"sendfile64"		}, /* 71 */
+	{  6, 	TD, 	sys_pselect6, 			"pselect6"		}, /* 72 */
+	{  5, 	TD, 	sys_ppoll, 			"ppoll"			}, /* 73 */
+	{  4, 	TD|TS, 	sys_signalfd4, 			"signalfd4"		}, /* 74 */
+	{  4, 	TD, 	sys_vmsplice, 			"vmsplice"		}, /* 75 */
+	{  6, 	TD, 	sys_splice, 			"splice"		}, /* 76 */
+	{  4, 	TD, 	sys_tee, 			"tee"			}, /* 77 */
+	{  4, 	TD|TF, 	sys_readlinkat, 		"readlinkat"		}, /* 78 */
+	{  4, 	TD|TF, 	sys_newfstatat, 		"fstatat64"		}, /* 79 */
+	{  2, 	TD, 	sys_fstat64, 			"fstat64"		}, /* 80 */
+	{  0, 	0, 	sys_sync, 			"sync"			}, /* 81 */
+	{  1, 	TD, 	sys_fsync, 			"fsync"			}, /* 82 */
+	{  1, 	TD, 	sys_fdatasync, 			"fdatasync"		}, /* 83 */
+	{  4, 	TD, 	sys_sync_file_range, 		"sync_file_range"	}, /* 84 */
+	{  4, 	TD, 	sys_timerfd_create, 		"timerfd_create"	}, /* 85 */
+	{  4, 	TD, 	sys_timerfd_settime, 		"timerfd_settime"	}, /* 86 */
+	{  2, 	TD, 	sys_timerfd_gettime, 		"timerfd_gettime"	}, /* 87 */
+	{  4, 	TD|TF, 	sys_utimensat, 			"utimensat"		}, /* 88 */
+	{  1, 	TF, 	sys_acct, 			"acct"			}, /* 89 */
+	{  2, 	0, 	sys_capget, 			"capget"		}, /* 90 */
+	{  2, 	0, 	sys_capset, 			"capset"		}, /* 91 */
+	{  1, 	0, 	sys_personality, 		"personality"		}, /* 92 */
+	{  1, 	TP, 	sys_exit, 			"exit"			}, /* 93 */
+	{  1, 	TP, 	sys_exit, 			"exit_group"		}, /* 94 */
+	{  5, 	TP, 	sys_waitid, 			"waitid"		}, /* 95 */
+	{  1, 	0, 	sys_set_tid_address, 		"set_tid_address"	}, /* 96 */
+	{  1, 	TP, 	sys_unshare, 			"unshare"		}, /* 97 */
+	{  6, 	0, 	sys_futex, 			"futex"			}, /* 98 */
+	{  2, 	0, 	sys_set_robust_list, 		"set_robust_list"	}, /* 99 */
+	{  3, 	0, 	sys_get_robust_list, 		"get_robust_list"	}, /* 100 */
+	{  2, 	0, 	sys_nanosleep, 			"nanosleep"		}, /* 101 */
+	{  2, 	0, 	sys_getitimer, 			"getitimer"		}, /* 102 */
+	{  3, 	0, 	sys_setitimer, 			"setitimer"		}, /* 103 */
+	{  4, 	0, 	sys_kexec_load, 		"kexec_load"		}, /* 104 */
+	{  3, 	0, 	sys_init_module, 		"init_module"		}, /* 105 */
+	{  2, 	0, 	sys_delete_module, 		"delete_module"		}, /* 106 */
+	{  3, 	0, 	sys_timer_create, 		"timer_create"		}, /* 107 */
+	{  2, 	0, 	sys_timer_gettime, 		"timer_gettime"		}, /* 108 */
+	{  1, 	0, 	sys_timer_getoverrun, 		"timer_getoverrun"	}, /* 109 */
+	{  4, 	0, 	sys_timer_settime, 		"timer_settime"		}, /* 110 */
+	{  1, 	0, 	sys_timer_delete, 		"timer_delete"		}, /* 111 */
+	{  2, 	0, 	sys_clock_settime, 		"clock_settime"		}, /* 112 */
+	{  2, 	0, 	sys_clock_gettime, 		"clock_gettime"		}, /* 113 */
+	{  2, 	0, 	sys_clock_getres, 		"clock_getres"		}, /* 114 */
+	{  4, 	0, 	sys_clock_nanosleep, 		"clock_nanosleep"	}, /* 115 */
+	{  3, 	0, 	sys_syslog, 			"syslog"		}, /* 116 */
+	{  4, 	0, 	sys_ptrace, 			"ptrace"		}, /* 117 */
+	{  2, 	0, 	sys_sched_setparam, 		"sched_setparam"	}, /* 118 */
+	{  3, 	0, 	sys_sched_setscheduler, 	"sched_setscheduler"	}, /* 119 */
+	{  1, 	0, 	sys_sched_getscheduler, 	"sched_getscheduler"	}, /* 120 */
+	{  2, 	0, 	sys_sched_getparam, 		"sched_getparam"	}, /* 121 */
+	{  3, 	0, 	sys_sched_setaffinity, 		"sched_setaffinity"	}, /* 122 */
+	{  3, 	0, 	sys_sched_getaffinity, 		"sched_getaffinity"	}, /* 123 */
+	{  0, 	0, 	sys_sched_yield, 		"sched_yield"		}, /* 124 */
+	{  1, 	0, 	sys_sched_get_priority_max,	"sched_get_priority_max"}, /* 125 */
+	{  1, 	0, 	sys_sched_get_priority_min,	"sched_get_priority_min"}, /* 126 */
+	{  2, 	0, 	sys_sched_rr_get_interval,	"sched_rr_get_interval" }, /* 127 */
+	{  0, 	0, 	sys_restart_syscall,		"restart_syscall"	}, /* 128 */
+	{  2, 	TS, 	sys_kill, 			"kill"			}, /* 129 */
+	{  2, 	TS, 	sys_kill, 			"tkill"			}, /* 130 */
+	{  3, 	TS, 	sys_tgkill, 			"tgkill"		}, /* 131 */
+	{  2, 	TS, 	sys_sigaltstack, 		"sigaltstack"		}, /* 132 */
+	{  2, 	TS, 	sys_rt_sigsuspend, 		"rt_sigsuspend"		}, /* 133 */
+	{  4, 	TS, 	sys_rt_sigaction, 		"rt_sigaction"		}, /* 134 */
+	{  4, 	TS, 	sys_rt_sigprocmask, 		"rt_sigprocmask"	}, /* 135 */
+	{  2, 	TS, 	sys_rt_sigpending, 		"rt_sigpending"		}, /* 136 */
+	{  4, 	TS, 	sys_rt_sigtimedwait, 		"rt_sigtimedwait"	}, /* 137 */
+	{  3, 	TS, 	sys_rt_sigqueueinfo, 		"rt_sigqueueinfo"	}, /* 138 */
+	{  0, 	TS, 	sys_rt_sigreturn, 		"rt_sigreturn"		}, /* 139 */
+	{  3, 	0, 	sys_setpriority, 		"setpriority"		}, /* 140 */
+	{  2, 	0, 	sys_getpriority, 		"getpriority"		}, /* 141 */
+	{  4, 	0, 	sys_reboot, 			"reboot"		}, /* 142 */
+	{  2, 	0, 	sys_setregid, 			"setregid"		}, /* 143 */
+	{  1, 	0, 	sys_setgid, 			"setgid"		}, /* 144 */
+	{  2, 	0, 	sys_setreuid, 			"setreuid"		}, /* 145 */
+	{  1, 	0, 	sys_setuid, 			"setuid"		}, /* 146 */
+	{  3, 	0, 	sys_setresuid, 			"setresuid"		}, /* 147 */
+	{  3, 	0, 	sys_getresuid, 			"getresuid"		}, /* 148 */
+	{  3, 	0, 	sys_setresgid, 			"setresgid"		}, /* 149 */
+	{  3, 	0, 	sys_getresgid, 			"getresgid"		}, /* 150 */
+	{  1, 	NF, 	sys_setfsuid, 			"setfsuid"		}, /* 151 */
+	{  1, 	NF, 	sys_setfsgid, 			"setfsgid"		}, /* 152 */
+	{  1, 	0, 	sys_times, 			"times"			}, /* 153 */
+	{  2, 	0, 	sys_setpgid, 			"setpgid"		}, /* 154 */
+	{  1, 	0, 	sys_getpgid, 			"getpgid"		}, /* 155 */
+	{  1, 	0, 	sys_getsid, 			"getsid"		}, /* 156 */
+	{  0, 	0, 	sys_setsid, 			"setsid"		}, /* 157 */
+	{  2, 	0, 	sys_getgroups, 			"getgroups"		}, /* 158 */
+	{  2, 	0, 	sys_setgroups, 			"setgroups"		}, /* 159 */
+	{  1, 	0, 	sys_uname, 			"uname"			}, /* 160 */
+	{  2, 	0, 	sys_sethostname, 		"sethostname"		}, /* 161 */
+	{  2, 	0, 	sys_setdomainname, 		"setdomainname"		}, /* 162 */
+	{  2, 	0, 	sys_getrlimit, 			"oldgetrlimit"		}, /* 163 */
+	{  2, 	0, 	sys_setrlimit, 			"setrlimit"		}, /* 164 */
+	{  2, 	0, 	sys_getrusage, 			"getrusage"		}, /* 165 */
+	{  1, 	0, 	sys_umask, 			"umask"			}, /* 166 */
+	{  5, 	0, 	sys_prctl, 			"prctl"			}, /* 167 */
+	{  3, 	0, 	sys_getcpu, 			"getcpu"		}, /* 168 */
+	{  2, 	0, 	sys_gettimeofday, 		"gettimeofday"		}, /* 169 */
+	{  2, 	0, 	sys_settimeofday, 		"settimeofday"		}, /* 170 */
+	{  1, 	0, 	sys_adjtimex, 			"adjtimex"		}, /* 171 */
+	{  0, 	0, 	sys_getpid, 			"getpid"		}, /* 172 */
+	{  0, 	0, 	sys_getppid, 			"getppid"		}, /* 173 */
+	{  0, 	NF, 	sys_getuid, 			"getuid"		}, /* 174 */
+	{  0, 	NF, 	sys_geteuid, 			"geteuid"		}, /* 175 */
+	{  0, 	NF, 	sys_getgid, 			"getgid"		}, /* 176 */
+	{  0, 	NF, 	sys_getegid, 			"getegid"		}, /* 177 */
+	{  0, 	0, 	sys_gettid, 			"gettid"		}, /* 178 */
+	{  1, 	0, 	sys_sysinfo, 			"sysinfo"		}, /* 179 */
+	{  4, 	0, 	sys_mq_open, 			"mq_open"		}, /* 180 */
+	{  1, 	0, 	sys_mq_unlink, 			"mq_unlink"		}, /* 181 */
+	{  5, 	0, 	sys_mq_timedsend, 		"mq_timedsend"		}, /* 182 */
+	{  5, 	0, 	sys_mq_timedreceive, 		"mq_timedreceive"	}, /* 183 */
+	{  2, 	0, 	sys_mq_notify, 			"mq_notify"		}, /* 184 */
+	{  3, 	0, 	sys_mq_getsetattr, 		"mq_getsetattr"		}, /* 185 */
+	{  4, 	TI, 	sys_msgget, 			"msgget"		}, /* 186 */
+	{  4, 	TI, 	sys_msgctl, 			"msgctl"		}, /* 187 */
+	{  4, 	TI, 	sys_msgrcv, 			"msgrcv"		}, /* 188 */
+	{  4, 	TI, 	sys_msgsnd, 			"msgsnd"		}, /* 189 */
+	{  4, 	TI, 	sys_semget, 			"semget"		}, /* 190 */
+	{  4, 	TI, 	sys_semctl, 			"semctl"		}, /* 191 */
+	{  5, 	TI, 	sys_semtimedop, 		"semtimedop"		}, /* 192 */
+	{  4, 	TI, 	sys_semop, 			"semop"			}, /* 193 */
+	{  4, 	TI, 	sys_shmget, 			"shmget"		}, /* 194 */
+	{  4, 	TI, 	sys_shmctl, 			"shmctl"		}, /* 195 */
+	{  4, 	TI, 	sys_shmat, 			"shmat"			}, /* 196 */
+	{  4, 	TI, 	sys_shmdt, 			"shmdt"			}, /* 197 */
+	{  3, 	TN, 	sys_socket, 			"socket"		}, /* 198 */
+	{  4, 	TN, 	sys_socketpair, 		"socketpair"		}, /* 199 */
+	{  3, 	TN, 	sys_bind, 			"bind"			}, /* 200 */
+	{  2, 	TN, 	sys_listen, 			"listen"		}, /* 201 */
+	{  3, 	TN, 	sys_accept, 			"accept"		}, /* 202 */
+	{  3, 	TN, 	sys_connect, 			"connect"		}, /* 203 */
+	{  3, 	TN, 	sys_getsockname, 		"getsockname"		}, /* 204 */
+	{  3, 	TN, 	sys_getpeername, 		"getpeername"		}, /* 205 */
+	{  6, 	TN, 	sys_sendto, 			"sendto"		}, /* 206 */
+	{  6, 	TN, 	sys_recvfrom, 			"recvfrom"		}, /* 207 */
+	{  5, 	TN, 	sys_setsockopt, 		"setsockopt"		}, /* 208 */
+	{  5, 	TN, 	sys_getsockopt, 		"getsockopt"		}, /* 209 */
+	{  2, 	TN, 	sys_shutdown, 			"shutdown"		}, /* 210 */
+	{  3, 	TN, 	sys_sendmsg, 			"sendmsg"		}, /* 211 */
+	{  5, 	TN, 	sys_recvmsg, 			"recvmsg"		}, /* 212 */
+	{  5, 	TD, 	sys_readahead, 			"readahead"		}, /* 213 */
+	{  1, 	0, 	sys_brk, 			"brk"			}, /* 214 */
+	{  2, 	0, 	sys_munmap, 			"munmap"		}, /* 215 */
+	{  5, 	0, 	sys_mremap, 			"mremap"		}, /* 216 */
+	{  5, 	0, 	sys_add_key, 			"add_key"		}, /* 217 */
+	{  4, 	0, 	sys_request_key, 		"request_key"		}, /* 218 */
+	{  5, 	0, 	sys_keyctl, 			"keyctl"		}, /* 219 */
+	{  5, 	TP, 	sys_clone, 			"clone"			}, /* 220 */
+	{  3, 	TF|TP, 	sys_execve, 			"execve"		}, /* 221 */
+	{  6, 	TD, 	sys_mmap, 			"mmap2"			}, /* 222 */
+	{  6, 	TD, 	sys_fadvise64_64, 		"fadvise64_64"		}, /* 223 */
+	{  2, 	TF, 	sys_swapon, 			"swapon"		}, /* 224 */
+	{  1, 	TF, 	sys_swapoff, 			"swapoff"		}, /* 225 */
+	{  3, 	0, 	sys_mprotect, 			"mprotect"		}, /* 226 */
+	{  3, 	0, 	sys_msync, 			"msync"			}, /* 227 */
+	{  2, 	0, 	sys_mlock, 			"mlock"			}, /* 228 */
+	{  2, 	0, 	sys_munlock, 			"munlock"		}, /* 229 */
+	{  1, 	0, 	sys_mlockall, 			"mlockall"		}, /* 230 */
+	{  0, 	0, 	sys_munlockall, 		"munlockall"		}, /* 231 */
+	{  3, 	0, 	sys_mincore, 			"mincore"		}, /* 232 */
+	{  3, 	0, 	sys_madvise, 			"madvise"		}, /* 233 */
+	{  5, 	0, 	sys_remap_file_pages, 		"remap_file_pages"	}, /* 234 */
+	{  6, 	0, 	sys_mbind, 			"mbind"			}, /* 235 */
+	{  5, 	0, 	sys_get_mempolicy, 		"get_mempolicy"		}, /* 236 */
+	{  3, 	0, 	sys_set_mempolicy, 		"set_mempolicy"		}, /* 237 */
+	{  5, 	0, 	sys_migrate_pages, 		"migrate_pages"		}, /* 238 */
+	{  6, 	0, 	sys_move_pages, 		"move_pages"		}, /* 239 */
+	{  4, 	TP|TS, 	sys_rt_tgsigqueueinfo, 		"rt_tgsigqueueinfo"	}, /* 240 */
+	{  5, 	TD, 	sys_perf_event_open, 		"perf_event_open"	}, /* 241 */
+	{  4, 	TN, 	sys_accept4, 			"accept4"		}, /* 242 */
+	{  5, 	TN, 	sys_recvmmsg, 			"recvmmsg"		}, /* 243 */
+
+	{  3, 	0, 	printargs, 			"or1k_atomic" 		}, /* 244 */
+	[245 ... 259] = { },
+
+	{  4, 	TP, 	sys_wait4, 			"wait4"			}, /* 260 */
+	{  4, 	0, 	sys_prlimit64, 			"prlimit64"		}, /* 261 */
+	{  2, 	TD, 	sys_fanotify_init, 		"fanotify_init"		}, /* 262 */
+	{  5, 	TD|TF, 	sys_fanotify_mark, 		"fanotify_mark"		}, /* 263 */
+	{  5, 	TD|TF, 	sys_name_to_handle_at, 		"name_to_handle_at"	}, /* 264 */
+	{  3, 	TD, 	sys_open_by_handle_at, 		"open_by_handle_at"	}, /* 265 */
+	{  2, 	0, 	sys_clock_adjtime, 		"clock_adjtime"		}, /* 266 */
+	{  1, 	TD, 	sys_syncfs, 			"syncfs"		}, /* 267 */
+	{  2, 	TD, 	sys_setns, 			"setns"			}, /* 268 */
+	{  4, 	TN, 	sys_sendmmsg, 			"sendmmsg"		}, /* 269 */
+	{  6, 	0, 	sys_process_vm_readv, 		"process_vm_readv"	}, /* 270 */
+	{  6, 	0, 	sys_process_vm_writev, 		"process_vm_writev"	}, /* 271 */
diff --git a/process.c b/process.c
index 6cf296c..3e92d84 100644
--- a/process.c
+++ b/process.c
@@ -2116,11 +2116,48 @@ const struct xlat struct_user_offsets[] = {
 	{ PT_FSR,		"rfsr",					},
 	{ PT_KERNEL_MODE,	"kernel_mode",				},
 #endif
+#ifdef OR1K
+	{ 4*0,  "r0" },
+	{ 4*1,  "r1" },
+	{ 4*2,  "r2" },
+	{ 4*3,  "r3" },
+	{ 4*4,  "r4" },
+	{ 4*5,  "r5" },
+	{ 4*6,  "r6" },
+	{ 4*7,  "r7" },
+	{ 4*8,  "r8" },
+	{ 4*9,  "r9" },
+	{ 4*10, "r10" },
+	{ 4*11, "r11" },
+	{ 4*12, "r12" },
+	{ 4*13, "r13" },
+	{ 4*14, "r14" },
+	{ 4*15, "r15" },
+	{ 4*16, "r16" },
+	{ 4*17, "r17" },
+	{ 4*18, "r18" },
+	{ 4*19, "r19" },
+	{ 4*20, "r20" },
+	{ 4*21, "r21" },
+	{ 4*22, "r22" },
+	{ 4*23, "r23" },
+	{ 4*24, "r24" },
+	{ 4*25, "r25" },
+	{ 4*26, "r26" },
+	{ 4*27, "r27" },
+	{ 4*28, "r28" },
+	{ 4*29, "r29" },
+	{ 4*30, "r30" },
+	{ 4*31, "r31" },
+	{ 4*32, "pc" },
+	{ 4*33, "sr" },
+#endif

 #if !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) \
 		&& !defined(ALPHA) && !defined(IA64) \
 		&& !defined(CRISV10) && !defined(CRISV32) \
-		&& !defined(MICROBLAZE) && !defined(AARCH64) && !defined(TILE)
+		&& !defined(MICROBLAZE) && !defined(AARCH64) \
+		&& !defined(TILE) && !defined(OR1K)
 # if !defined(S390) && !defined(S390X) && !defined(MIPS) &&
!defined(SPARC64) && !defined(AVR32) && !defined(BFIN)
 	{ uoff(u_fpvalid),	"offsetof(struct user, u_fpvalid)"	},
 # endif
@@ -2159,7 +2196,7 @@ const struct xlat struct_user_offsets[] = {
 # endif
 #endif /* !defined(many arches) */

-#if !defined(HPPA) && !defined(AARCH64) && !defined(TILE)
+#if !defined(HPPA) && !defined(AARCH64) && !defined(TILE) && !defined(OR1K)
 	{ sizeof(struct user),	"sizeof(struct user)"			},
 #endif
 	{ 0,			NULL					},
diff --git a/syscall.c b/syscall.c
index f403c44..29b89e0 100644
--- a/syscall.c
+++ b/syscall.c
@@ -71,6 +71,11 @@
 # include <elf.h>
 #endif

+#if defined(OR1K)
+# include <sys/uio.h>
+# include <elf.h>
+#endif
+
 #ifndef ERESTARTSYS
 # define ERESTARTSYS	512
 #endif
@@ -712,6 +717,11 @@ static long cris_r10;
 struct pt_regs tile_regs;
 #elif defined(MICROBLAZE)
 static long microblaze_r3;
+#elif defined(OR1K)
+static struct user_regs_struct or1k_regs;
+static struct iovec or1k_io = {
+	.iov_base = &or1k_regs
+};
 #endif

 void
@@ -847,6 +857,8 @@ printcall(struct tcb *tcp)
 # else
 	tprintf("[%08lx] ", (unsigned long) tile_regs.pc);
 # endif
+#elif defined(OR1K)
+	tprintf("[%08lx] ", or1k_regs.pc);
 #endif /* architecture */
 }

@@ -886,6 +898,9 @@ void get_regs(pid_t pid)
 	get_regs_error = ptrace(PTRACE_GETREGS, pid, (char *)&regs, 0);
 # elif defined(TILE)
 	get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, (long) &tile_regs);
+# elif defined(OR1K)
+	or1k_io.iov_len = sizeof(or1k_regs);
+	get_regs_error = ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, &or1k_io);
 # endif
 }
 #endif
@@ -1328,6 +1343,8 @@ get_scno(struct tcb *tcp)
 #elif defined(MICROBLAZE)
 	if (upeek(tcp, 0, &scno) < 0)
 		return -1;
+#elif defined(OR1K)
+	scno = or1k_regs.gpr[11];
 #endif

 #if defined(SH)
@@ -1712,6 +1729,10 @@ get_syscall_args(struct tcb *tcp)
 	tcp->u_arg[3] = i386_regs.esi;
 	tcp->u_arg[4] = i386_regs.edi;
 	tcp->u_arg[5] = i386_regs.ebp;
+#elif defined(OR1K)
+	(void)nargs;
+	for (i = 0; i < 6; ++i)
+		tcp->u_arg[i] = or1k_regs.gpr[3 + i];
 #else /* Other architecture (32bits specific) */
 	for (i = 0; i < nargs; ++i)
 		if (upeek(tcp, i*4, &tcp->u_arg[i]) < 0)
@@ -1906,6 +1927,8 @@ get_syscall_result(struct tcb *tcp)
 #elif defined(MICROBLAZE)
 	if (upeek(tcp, 3 * 4, &microblaze_r3) < 0)
 		return -1;
+#elif defined(OR1K)
+	/* already done by get_regs */
 #endif
 	return 1;
 }
@@ -2147,6 +2170,14 @@ get_error(struct tcb *tcp)
 	else {
 		tcp->u_rval = microblaze_r3;
 	}
+#elif defined(OR1K)
+	if (check_errno && is_negated_errno(or1k_regs.gpr[11])) {
+		tcp->u_rval = -1;
+		u_error = -or1k_regs.gpr[11];
+	}
+	else {
+		tcp->u_rval = or1k_regs.gpr[11];
+	}
 #endif
 	tcp->u_error = u_error;
 	return 1;
diff --git a/util.c b/util.c
index 93a98f6..4dd977b 100644
--- a/util.c
+++ b/util.c
@@ -1291,6 +1291,8 @@ change_syscall(struct tcb *tcp, arg_setup_state
*state, int new)
 	if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR(0)), new) < 0)
 		return -1;
 	return 0;
+#elif defined(OR1K)
+	/* never reached; OR1K is only supported by kernels since 3.1.0. */
 #else
 #warning Do not know how to handle change_syscall for this architecture
 #endif /* architecture */
-- 
1.8.1.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Support-for-the-OpenRISC-1000-platform.patch
Type: application/octet-stream
Size: 21906 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20130212/d890e3d1/attachment.obj>


More information about the Strace-devel mailing list