]> granicus.if.org Git - strace/commitdiff
2003-07-28 Daniel Jacobowitz <drow@mvista.com>
authorRoland McGrath <roland@redhat.com>
Thu, 21 Aug 2003 09:58:00 +0000 (09:58 +0000)
committerRoland McGrath <roland@redhat.com>
Thu, 21 Aug 2003 09:58:00 +0000 (09:58 +0000)
* 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.

defs.h
io.c
linux/mips/syscallent.h
linux/sh/syscallent.h
process.c

diff --git a/defs.h b/defs.h
index ff06f4e084769dd42f22f4bac59df9c28a6c44c5..504cbf5f0bfc6a36b6dbef9fcc330f38598effde 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -562,7 +562,8 @@ extern int nsignals2;
 #endif /* SUPPORTED_PERSONALITIES >= 3 */
 
 #if defined(FREEBSD) || (defined(LINUX) \
-                        && defined(POWERPC) && !defined(__powerpc64__))
+                        && defined(POWERPC) && !defined(__powerpc64__)) \
+  || (defined (LINUX) && defined (MIPS) && !defined(__mips64))
 /* ARRGH!  off_t args are aligned on 64 bit boundaries! */
 #define ALIGN64(tcp,arg)                                               \
 do {                                                                   \
diff --git a/io.c b/io.c
index 893ee619aac67ebfa8b8d001d06351d9566773c0..65b48fdb96541e24d4c03b03ee1d3a604eea01f1 100644 (file)
--- 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;
 }
index be6ed70eefab81d0ec9284bd46d6d331f477c9fc..8f41314019edcc44ee99ac588889b23f8219dbcd 100644 (file)
        { 4,    TS,     sys_rt_sigtimedwait,    "rt_sigtimedwait"},/* 4197 */
        { 3,    TS,     sys_rt_sigqueueinfo,    "rt_sigqueueinfo"},/* 4198 */
        { 2,    TS,     sys_rt_sigsuspend,      "rt_siguspend"  }, /* 4199 */
-       { 5,    TF,     sys_pread,              "pread"         }, /* 4200 */
-       { 5,    TF,     sys_pwrite,             "pwrite"        }, /* 4201 */
+       { 6,    TF,     sys_pread,              "pread"         }, /* 4200 */
+       { 6,    TF,     sys_pwrite,             "pwrite"        }, /* 4201 */
        { 3,    TF,     sys_chown,              "chown"         }, /* 4202 */
        { 2,    TF,     sys_getcwd,             "getcwd"        }, /* 4203 */
        { 2,    0,      sys_capget,             "capget"        }, /* 4204 */
        { 0,    0,      printargs,              "SYS_4208"      }, /* 4208 */
        { 0,    0,      printargs,              "SYS_4209"      }, /* 4209 */
        { 6,    0,      sys_mmap,               "mmap"          }, /* 4210 */
-       { 2,    TF,     sys_truncate64,         "truncate64"    }, /* 4211 */
-       { 2,    TF,     sys_ftruncate64,        "ftruncate64"   }, /* 4212 */
+       { 4,    TF,     sys_truncate64,         "truncate64"    }, /* 4211 */
+       { 4,    TF,     sys_ftruncate64,        "ftruncate64"   }, /* 4212 */
        { 2,    TF,     printargs,              "stat64"        }, /* 4213 */
        { 2,    TF,     sys_lstat64,            "lstat64"       }, /* 4214 */
        { 2,    TF,     sys_fstat64,            "fstat64"       }, /* 4215 */
index 2b83dda0b0a8ba2fba565b2b1014cc7ca41a4ec1..f6a01a62dd74fd83e9e016a4161786b81af1d81b 100644 (file)
        { 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 */
+       { 6,    TF,     sys_pread,              "pread"         }, /* 180 */
+       { 6,    TF,     sys_pwrite,             "pwrite"        }, /* 181 */
        { 3,    TF,     sys_chown,              "chown"         }, /* 182 */
        { 2,    0,      sys_getcwd,             "getcwd"        }, /* 183 */
        { 2,    0,      sys_capget,             "capget"        }, /* 184 */
        { 0,    TP,     sys_vfork,              "vfork"         }, /* 190 */
        { 5,    0,      printargs,              "getrlimit"     }, /* 191 */
        { 6,    0,      sys_mmap,               "mmap2"         }, /* 192 */
-       { 5,    0,      printargs,              "truncate64"    }, /* 193 */
-       { 5,    0,      printargs,              "ftruncate64"   }, /* 194 */
+       { 5,    0,      sys_truncate64,         "truncate64"    }, /* 193 */
+       { 5,    0,      sys_ftruncate64,        "ftruncate64"   }, /* 194 */
        { 2,    TF,     sys_stat64,             "stat64"        }, /* 195 */
        { 2,    TF,     sys_lstat64,            "lstat64"       }, /* 196 */
        { 2,    TF,     sys_fstat64,            "fstat64"       }, /* 197 */
index 231820faddee6f8a0968dad2f6c9a23a9c4977a9..75a316d78b43d3817769bf06432be3a6f4f86db0 100644 (file)
--- a/process.c
+++ b/process.c
@@ -2465,6 +2465,7 @@ struct xlat struct_user_offsets[] = {
        { 4*(REG_FPREG0+13),    "4*REG_FPREG13"                         },
        { 4*(REG_FPREG0+14),    "4*REG_FPREG14"                         },
        { 4*REG_FPREG15,        "4*REG_FPREG15"                         },
+#ifdef REG_XDREG0
        { 4*REG_XDREG0,         "4*REG_XDREG0"                          },
        { 4*(REG_XDREG0+2),     "4*REG_XDREG2"                          },
        { 4*(REG_XDREG0+4),     "4*REG_XDREG4"                          },
@@ -2473,6 +2474,7 @@ struct xlat struct_user_offsets[] = {
        { 4*(REG_XDREG0+10),    "4*REG_XDREG10"                         },
        { 4*(REG_XDREG0+12),    "4*REG_XDREG12"                         },
        { 4*REG_XDREG14,        "4*REG_XDREG14"                         },
+#endif
        { 4*REG_FPSCR,          "4*REG_FPSCR"                           },
 #endif /* SH */
 #ifdef SH64