aboutsummaryrefslogtreecommitdiff
path: root/linux/mips
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-12-10 10:10:13 -0800
committerElliott Hughes <enh@google.com>2015-12-10 10:10:13 -0800
commitf4b2cf666b676496f413064761d44bbd93522dbb (patch)
treea772d2f3d3796fe18f4f014f33d6bd87e25999e0 /linux/mips
parent6967bc2e4b39e3e67a8ff4e75cf6602c34a8d039 (diff)
parentbab4ef4272cd2596c7390b34ea8acc086ee8fdb2 (diff)
downloadstrace-f4b2cf666b676496f413064761d44bbd93522dbb.tar.gz
Merge remote-tracking branch 'strace/master' into HEAD
Change-Id: I65e4a0c7b98d3a813829088e8bcb34ed7d71fa3e
Diffstat (limited to 'linux/mips')
-rw-r--r--linux/mips/arch_regs.c1
-rw-r--r--linux/mips/arch_sigreturn.c40
-rw-r--r--linux/mips/get_error.c21
-rw-r--r--linux/mips/get_scno.c20
-rw-r--r--linux/mips/get_syscall_args.c13
-rw-r--r--linux/mips/print_pc.c1
-rw-r--r--linux/mips/syscallent-n32.h17
-rw-r--r--linux/mips/syscallent-n64.h15
-rw-r--r--linux/mips/syscallent-o32.h15
9 files changed, 88 insertions, 55 deletions
diff --git a/linux/mips/arch_regs.c b/linux/mips/arch_regs.c
index c46e6ebac..44f6bd5e8 100644
--- a/linux/mips/arch_regs.c
+++ b/linux/mips/arch_regs.c
@@ -1,3 +1,4 @@
struct mips_regs mips_regs; /* not static */
/* PTRACE_GETREGS on MIPS is available since linux v2.6.15. */
#define ARCH_REGS_FOR_GETREGS mips_regs
+#define ARCH_PC_REG mips_REG_EPC
diff --git a/linux/mips/arch_sigreturn.c b/linux/mips/arch_sigreturn.c
index 687f871db..3095fe591 100644
--- a/linux/mips/arch_sigreturn.c
+++ b/linux/mips/arch_sigreturn.c
@@ -1,22 +1,26 @@
+static void
+arch_sigreturn(struct tcb *tcp)
+{
#if defined LINUX_MIPSO32
-/*
- * offsetof(struct sigframe, sf_mask) ==
- * sizeof(sf_ass) + sizeof(sf_pad) + sizeof(struct sigcontext)
- */
-const long addr = mips_REG_SP + 6 * 4 +
- sizeof(struct sigcontext);
+ /*
+ * offsetof(struct sigframe, sf_mask) ==
+ * sizeof(sf_ass) + sizeof(sf_pad) + sizeof(struct sigcontext)
+ */
+ const long addr = mips_REG_SP + 6 * 4 +
+ sizeof(struct sigcontext);
#else
-/*
- * This decodes rt_sigreturn.
- * The 64-bit ABIs do not have sigreturn.
- *
- * offsetof(struct rt_sigframe, rs_uc) ==
- * sizeof(sf_ass) + sizeof(sf_pad) + sizeof(struct siginfo)
- */
-const long addr = mips_REG_SP + 6 * 4 + 128 +
- offsetof(struct ucontext, uc_sigmask);
+ /*
+ * This decodes rt_sigreturn.
+ * The 64-bit ABIs do not have sigreturn.
+ *
+ * offsetof(struct rt_sigframe, rs_uc) ==
+ * sizeof(sf_ass) + sizeof(sf_pad) + sizeof(struct siginfo)
+ */
+ const long addr = mips_REG_SP + 6 * 4 + 128 +
+ offsetof(struct ucontext, uc_sigmask);
#endif
-tprints("{mask=");
-print_sigset_addr_len(tcp, addr, NSIG / 8);
-tprints("}");
+ tprints("{mask=");
+ print_sigset_addr_len(tcp, addr, NSIG / 8);
+ tprints("}");
+}
diff --git a/linux/mips/get_error.c b/linux/mips/get_error.c
index e934af08f..e58055e13 100644
--- a/linux/mips/get_error.c
+++ b/linux/mips/get_error.c
@@ -1,9 +1,14 @@
-if (check_errno && mips_REG_A3) {
- tcp->u_rval = -1;
- tcp->u_error = mips_REG_V0;
-} else {
-# if defined LINUX_MIPSN32
- tcp->u_lrval = mips_REG_V0;
-# endif
- tcp->u_rval = mips_REG_V0;
+static void
+get_error(struct tcb *tcp, const bool check_errno)
+{
+ if (check_errno && mips_REG_A3) {
+ tcp->u_rval = -1;
+ tcp->u_error = mips_REG_V0;
+ } else {
+ tcp->u_rval = mips_REG_V0;
+#ifdef LINUX_MIPSN32
+ /* tcp->u_rval contains a truncated value */
+ tcp->u_lrval = mips_REG_V0;
+#endif
+ }
}
diff --git a/linux/mips/get_scno.c b/linux/mips/get_scno.c
index 126cedecb..f9b5e7d71 100644
--- a/linux/mips/get_scno.c
+++ b/linux/mips/get_scno.c
@@ -1,9 +1,17 @@
-scno = mips_REG_V0;
+/* Return codes: 1 - ok, 0 - ignore, other - error. */
+static int
+arch_get_scno(struct tcb *tcp)
+{
+ tcp->scno = mips_REG_V0;
-if (!SCNO_IN_RANGE(scno)) {
- if (mips_REG_A3 == 0 || mips_REG_A3 == (uint64_t) -1) {
- if (debug_flag)
- error_msg("stray syscall exit: v0 = %ld", scno);
- return 0;
+ if (!SCNO_IN_RANGE(tcp->scno)) {
+ if (mips_REG_A3 == 0 || mips_REG_A3 == (uint64_t) -1) {
+ if (debug_flag)
+ error_msg("stray syscall exit: v0 = %ld",
+ tcp->scno);
+ return 0;
+ }
}
+
+ return 1;
}
diff --git a/linux/mips/get_syscall_args.c b/linux/mips/get_syscall_args.c
index 4e4a22b77..a20be8dee 100644
--- a/linux/mips/get_syscall_args.c
+++ b/linux/mips/get_syscall_args.c
@@ -1,3 +1,7 @@
+/* Return -1 on error or 1 on success (never 0!). */
+static int
+get_syscall_args(struct tcb *tcp)
+{
#if defined LINUX_MIPSN64
tcp->u_arg[0] = mips_REG_A0;
tcp->u_arg[1] = mips_REG_A1;
@@ -18,10 +22,13 @@
tcp->u_arg[2] = mips_REG_A2;
tcp->u_arg[3] = mips_REG_A3;
if (tcp->s_ent->nargs > 4) {
- umoven(tcp, mips_REG_SP + 4 * 4,
- (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
- &tcp->u_arg[4]);
+ if (umoven(tcp, mips_REG_SP + 4 * 4,
+ (tcp->s_ent->nargs - 4) * sizeof(tcp->u_arg[0]),
+ &tcp->u_arg[4]) < 0)
+ return -1;
}
#else
# error unsupported mips abi
#endif
+ return 1;
+}
diff --git a/linux/mips/print_pc.c b/linux/mips/print_pc.c
deleted file mode 100644
index 569b0b6b7..000000000
--- a/linux/mips/print_pc.c
+++ /dev/null
@@ -1 +0,0 @@
-tprintf(fmt, (unsigned long) mips_REG_EPC);
diff --git a/linux/mips/syscallent-n32.h b/linux/mips/syscallent-n32.h
index ea3fb9815..f97511dae 100644
--- a/linux/mips/syscallent-n32.h
+++ b/linux/mips/syscallent-n32.h
@@ -22,7 +22,7 @@
[6019] = { 3, TD, SEN(writev), "writev" },
[6020] = { 2, TF, SEN(access), "access" },
[6021] = { 1, TD, SEN(pipe), "pipe" },
-[6022] = { 5, TD, SEN(select), "select" },
+[6022] = { 5, TD, SEN(select), "_newselect" },
[6023] = { 0, 0, SEN(sched_yield), "sched_yield" },
[6024] = { 5, TM|SI, SEN(mremap), "mremap" },
[6025] = { 3, TM, SEN(msync), "msync" },
@@ -136,7 +136,7 @@
[6133] = { 2, 0, SEN(ustat), "ustat" },
[6134] = { 3, TF, SEN(statfs), "statfs" },
[6135] = { 3, TD, SEN(fstatfs), "fstatfs" },
-[6136] = { 5, 0, SEN(sysfs), "sysfs" },
+[6136] = { 3, 0, SEN(sysfs), "sysfs" },
[6137] = { 2, 0, SEN(getpriority), "getpriority" },
[6138] = { 3, 0, SEN(setpriority), "setpriority" },
[6139] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
@@ -174,8 +174,8 @@
[6171] = { 5, 0, SEN(query_module), "query_module" },
[6172] = { 4, TF, SEN(quotactl), "quotactl" },
[6173] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
-[6174] = { 5, TN, SEN(printargs), "getpmsg" },
-[6175] = { 5, TN, SEN(printargs), "putpmsg" },
+[6174] = { 5, TN, SEN(getpmsg), "getpmsg" },
+[6175] = { 5, TN, SEN(putpmsg), "putpmsg" },
[6176] = { 0, 0, SEN(afs_syscall), "afs_syscall" },
[6177] = { 0, 0, SEN(printargs), "reserved177" },
[6178] = { 0, 0, SEN(gettid), "gettid" },
@@ -212,11 +212,11 @@
[6209] = { 4, TD, SEN(epoll_wait), "epoll_wait" },
[6210] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[6211] = { 0, TS, SEN(rt_sigreturn), "rt_sigreturn" },
-[6212] = { 3, TD, SEN(fcntl), "fcntl64" },
+[6212] = { 3, TD, SEN(fcntl64), "fcntl64" },
[6213] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[6214] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[6215] = { 4, TI, SEN(semtimedop), "semtimedop" },
-[6216] = { 4, TD, SEN(fadvise64), "fadvise64" },
+[6216] = { 4, TD, SEN(fadvise64_64), "fadvise64" },
[6217] = { 3, TF, SEN(statfs64), "statfs64" },
[6218] = { 3, TD, SEN(fstatfs64), "fstatfs64" },
[6219] = { 4, TD|TN, SEN(sendfile64), "sendfile64" },
@@ -321,7 +321,10 @@
[6318] = { 2, TD, SEN(memfd_create), "memfd_create", },
[6319] = { 3, TD, SEN(bpf), "bpf", },
[6320] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
-[6321 ... 6399] = { },
+[6321] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
+[6322] = { 2, 0, SEN(membarrier), "membarrier", },
+[6323] = { 3, TM, SEN(mlock2), "mlock2" },
+[6324 ... 6399] = { },
# define SYS_socket_subcall 6400
# include "subcall.h"
diff --git a/linux/mips/syscallent-n64.h b/linux/mips/syscallent-n64.h
index 1a7147ed6..9f3203809 100644
--- a/linux/mips/syscallent-n64.h
+++ b/linux/mips/syscallent-n64.h
@@ -22,7 +22,7 @@
[5019] = { 3, TD, SEN(writev), "writev" },
[5020] = { 2, TF, SEN(access), "access" },
[5021] = { 1, TD, SEN(pipe), "pipe" },
-[5022] = { 5, TD, SEN(select), "select" },
+[5022] = { 5, TD, SEN(select), "_newselect" },
[5023] = { 0, 0, SEN(sched_yield), "sched_yield" },
[5024] = { 5, TM|SI, SEN(mremap), "mremap" },
[5025] = { 3, TM, SEN(msync), "msync" },
@@ -136,7 +136,7 @@
[5133] = { 2, 0, SEN(ustat), "ustat" },
[5134] = { 3, TF, SEN(statfs), "statfs" },
[5135] = { 3, TD, SEN(fstatfs), "fstatfs" },
-[5136] = { 5, 0, SEN(sysfs), "sysfs" },
+[5136] = { 3, 0, SEN(sysfs), "sysfs" },
[5137] = { 2, 0, SEN(getpriority), "getpriority" },
[5138] = { 3, 0, SEN(setpriority), "setpriority" },
[5139] = { 2, 0, SEN(sched_setparam), "sched_setparam" },
@@ -174,8 +174,8 @@
[5171] = { 5, 0, SEN(query_module), "query_module" },
[5172] = { 4, TF, SEN(quotactl), "quotactl" },
[5173] = { 3, 0, SEN(nfsservctl), "nfsservctl" },
-[5174] = { 5, TN, SEN(printargs), "getpmsg" },
-[5175] = { 5, TN, SEN(printargs), "putpmsg" },
+[5174] = { 5, TN, SEN(getpmsg), "getpmsg" },
+[5175] = { 5, TN, SEN(putpmsg), "putpmsg" },
[5176] = { 0, 0, SEN(afs_syscall), "afs_syscall" },
[5177] = { 0, 0, SEN(printargs), "reserved177" },
[5178] = { 0, 0, SEN(gettid), "gettid" },
@@ -215,7 +215,7 @@
[5212] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[5213] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
[5214] = { 4, TI, SEN(semtimedop), "semtimedop" },
-[5215] = { 4, TD, SEN(fadvise64_64), "fadvise64_64" },
+[5215] = { 4, TD, SEN(fadvise64_64), "fadvise64" },
[5216] = { 3, 0, SEN(timer_create), "timer_create" },
[5217] = { 4, 0, SEN(timer_settime), "timer_settime" },
[5218] = { 2, 0, SEN(timer_gettime), "timer_gettime" },
@@ -317,7 +317,10 @@
[5314] = { 2, TD, SEN(memfd_create), "memfd_create", },
[5315] = { 3, TD, SEN(bpf), "bpf", },
[5316] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
-[5317 ... 5399] = { },
+[5317] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
+[5318] = { 2, 0, SEN(membarrier), "membarrier", },
+[5319] = { 3, TM, SEN(mlock2), "mlock2" },
+[5320 ... 5399] = { },
# define SYS_socket_subcall 5400
# include "subcall.h"
diff --git a/linux/mips/syscallent-o32.h b/linux/mips/syscallent-o32.h
index ef9752dfe..ab1f6c57e 100644
--- a/linux/mips/syscallent-o32.h
+++ b/linux/mips/syscallent-o32.h
@@ -142,7 +142,7 @@
[4139] = { 1, NF, SEN(setfsgid), "setfsgid" },
[4140] = { 5, TD, SEN(llseek), "_llseek" },
[4141] = { 3, TD, SEN(getdents), "getdents" },
-[4142] = { 5, TD, SEN(select), "select" },
+[4142] = { 5, TD, SEN(select), "_newselect" },
[4143] = { 2, TD, SEN(flock), "flock" },
[4144] = { 3, TM, SEN(msync), "msync" },
[4145] = { 3, TD, SEN(readv), "readv" },
@@ -208,8 +208,8 @@
[4205] = { 2, 0, SEN(capset), "capset" },
[4206] = { 2, TS, SEN(sigaltstack), "sigaltstack" },
[4207] = { 4, TD|TN, SEN(sendfile), "sendfile" },
-[4208] = { 5, TN, SEN(printargs), "getpmsg" },
-[4209] = { 5, TN, SEN(printargs), "putpmsg" },
+[4208] = { 5, TN, SEN(getpmsg), "getpmsg" },
+[4209] = { 5, TN, SEN(putpmsg), "putpmsg" },
[4210] = { 6, TD|TM|SI, SEN(mmap_4koff), "mmap2" },
[4211] = { 4, TF, SEN(truncate64), "truncate64" },
[4212] = { 4, TD, SEN(ftruncate64), "ftruncate64" },
@@ -220,7 +220,7 @@
[4217] = { 3, TM, SEN(mincore), "mincore" },
[4218] = { 3, TM, SEN(madvise), "madvise" },
[4219] = { 3, TD, SEN(getdents64), "getdents64" },
-[4220] = { 3, TD, SEN(fcntl), "fcntl64" },
+[4220] = { 3, TD, SEN(fcntl64), "fcntl64" },
[4221] = { },
[4222] = { 0, 0, SEN(gettid), "gettid" },
[4223] = { 5, TD, SEN(readahead), "readahead" },
@@ -254,7 +254,7 @@
[4251] = { 5, TM|SI, SEN(remap_file_pages), "remap_file_pages" },
[4252] = { 1, 0, SEN(set_tid_address), "set_tid_address" },
[4253] = { 0, 0, SEN(restart_syscall), "restart_syscall" },
-[4254] = { 7, TD, SEN(fadvise64_64), "fadvise64_64" },
+[4254] = { 7, TD, SEN(fadvise64_64), "fadvise64" },
[4255] = { 3, TF, SEN(statfs64), "statfs64" },
[4256] = { 2, TD, SEN(fstatfs64), "fstatfs64" },
[4257] = { 3, 0, SEN(timer_create), "timer_create" },
@@ -357,7 +357,10 @@
[4354] = { 2, TD, SEN(memfd_create), "memfd_create", },
[4355] = { 3, TD, SEN(bpf), "bpf", },
[4356] = { 5, TD|TF|TP|SE|SI, SEN(execveat), "execveat", },
-[4357 ... 4399] = { },
+[4357] = { 1, TD, SEN(userfaultfd), "userfaultfd", },
+[4358] = { 2, 0, SEN(membarrier), "membarrier", },
+[4359] = { 3, TM, SEN(mlock2), "mlock2" },
+[4360 ... 4399] = { },
# define SYS_socket_subcall 4400
# include "subcall.h"