summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2003-08-21 09:58:00 +0000
committerRoland McGrath <roland@redhat.com>2003-08-21 09:58:00 +0000
commitc0f8bbda62139da801bb761d8c66724e12638087 (patch)
tree5e9052b2542e5e2c9a60986b7b136808ebafc62a /io.c
parent4d8130c85990fdf24e355366475854f26d91f1c8 (diff)
downloadstrace-c0f8bbda62139da801bb761d8c66724e12638087.tar.gz
strace-c0f8bbda62139da801bb761d8c66724e12638087.tar.bz2
strace-c0f8bbda62139da801bb761d8c66724e12638087.tar.xz
2003-07-28 Daniel Jacobowitz <drow@mvista.com>
* defs.h (ALIGN64): Define for MIPS. * io.c (PREAD_OFFSET_ARG): Define. (sys_pread, sys_pwrite): Use it. * process.c (struct_user_offsets) [SH]: Check whether REG_XDREG0 is defined. * linux/sh/syscallent.h (pread, pwrite): Take six arguments. (truncate64, ftruncate64): Pretty-print. * linux/mips/syscallent.h (pread, pwrite): Take six arguments. (truncate64, ftruncate64): Take four arguments.
Diffstat (limited to 'io.c')
-rw-r--r--io.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/io.c b/io.c
index 893ee61..65b48fd 100644
--- a/io.c
+++ b/io.c
@@ -231,6 +231,18 @@ struct tcb *tcp;
#endif /* FREEBSD */
#ifdef LINUX
+
+/* The SH4 ABI does allow long longs in odd-numbered registers, but
+ does not allow them to be split between registers and memory - and
+ there are only four argument registers for normal functions. As a
+ result pread takes an extra padding argument before the offset. This
+ was changed late in the 2.4 series (around 2.4.20). */
+#if defined(SH)
+#define PREAD_OFFSET_ARG 4
+#else
+#define PREAD_OFFSET_ARG 3
+#endif
+
int
sys_pread(tcp)
struct tcb *tcp;
@@ -242,9 +254,9 @@ struct tcb *tcp;
tprintf("%#lx", tcp->u_arg[1]);
else
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
- ALIGN64 (tcp, 3); /* PowerPC alignment restriction */
+ ALIGN64 (tcp, PREAD_OFFSET_ARG); /* PowerPC alignment restriction */
tprintf(", %lu, %llu", tcp->u_arg[2],
- *(unsigned long long *)&tcp->u_arg[3]);
+ *(unsigned long long *)&tcp->u_arg[PREAD_OFFSET_ARG]);
}
return 0;
}
@@ -256,9 +268,9 @@ struct tcb *tcp;
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
- ALIGN64 (tcp, 3); /* PowerPC alignment restriction */
+ ALIGN64 (tcp, PREAD_OFFSET_ARG); /* PowerPC alignment restriction */
tprintf(", %lu, %llu", tcp->u_arg[2],
- *(unsigned long long *)&tcp->u_arg[3]);
+ *(unsigned long long *)&tcp->u_arg[PREAD_OFFSET_ARG]);
}
return 0;
}