]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
DARWIN sync: pread64 and pwrite64 wrappers.
authorNicholas Nethercote <njn@valgrind.org>
Tue, 19 May 2009 06:50:37 +0000 (06:50 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Tue, 19 May 2009 06:50:37 +0000 (06:50 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9971

coregrind/m_syswrap/priv_syswrap-generic.h
coregrind/m_syswrap/syswrap-amd64-linux.c
coregrind/m_syswrap/syswrap-generic.c
coregrind/m_syswrap/syswrap-ppc32-linux.c
coregrind/m_syswrap/syswrap-ppc64-linux.c
coregrind/m_syswrap/syswrap-x86-linux.c

index 4bb4634e88dd421fe45d5f7d587911f128ed7ba2..29a66e0dff0222a884895e30b189cbfc372747bc 100644 (file)
@@ -186,10 +186,8 @@ DECL_TEMPLATE(generic, sys_fstatfs);               // * L?
 DECL_TEMPLATE(generic, sys_iopl);                  // (x86/amd64) L
 DECL_TEMPLATE(generic, sys_ipc);                   // (x86) L
 DECL_TEMPLATE(generic, sys_newuname);              // * P
-DECL_TEMPLATE(generic, sys_pread64_on32bitplat);   // * (Unix98?)
-DECL_TEMPLATE(generic, sys_pread64_on64bitplat);   // * (Unix98?)
-DECL_TEMPLATE(generic, sys_pwrite64_on32bitplat);  // * (Unix98?)
-DECL_TEMPLATE(generic, sys_pwrite64_on64bitplat);  // * (Unix98?)
+DECL_TEMPLATE(generic, sys_pread64);               // * (Unix98?)
+DECL_TEMPLATE(generic, sys_pwrite64);              // * (Unix98?)
 DECL_TEMPLATE(generic, sys_sigaltstack);           // (x86) (XPG4-UNIX)
 DECL_TEMPLATE(generic, sys_getpmsg);               // (?) (?)
 DECL_TEMPLATE(generic, sys_putpmsg);               // (?) (?)
index 27e158bc9249d718cc0ab361eb22a9c3ed269ef9..d11dc2fdc62f7aa72f9af86fb2e27c91b6634abd 100644 (file)
@@ -1035,8 +1035,8 @@ const SyscallTableEntry ML_(syscall_table)[] = {
 
    PLAX_(__NR_rt_sigreturn,      sys_rt_sigreturn),   // 15 
    LINXY(__NR_ioctl,             sys_ioctl),          // 16 
-   GENXY(__NR_pread64,           sys_pread64_on64bitplat),  // 17 
-   GENX_(__NR_pwrite64,          sys_pwrite64_on64bitplat), // 18 
+   GENXY(__NR_pread64,           sys_pread64),        // 17 
+   GENX_(__NR_pwrite64,          sys_pwrite64),       // 18 
    GENXY(__NR_readv,             sys_readv),          // 19 
 
    GENX_(__NR_writev,            sys_writev),         // 20 
index 5871bc3669c2a245f211fa78c1f7a77a394daba3..66f004a80b2a8e945171bad06833b26cd1165ffc 100644 (file)
@@ -2232,32 +2232,24 @@ PRE(sys_getpriority)
    PRE_REG_READ2(long, "getpriority", int, which, int, who);
 }
 
-PRE(sys_pwrite64_on64bitplat)
+PRE(sys_pwrite64)
 {
-   vg_assert(sizeof(UWord) == 8);
-   *flags |= SfMayBlock;
-   PRINT("sys_pwrite64 ( %ld, %#lx, %llu, %ld )",
-         ARG1, ARG2, (ULong)ARG3, ARG4);
-   PRE_REG_READ4(ssize_t, "pwrite64",
-                 unsigned int, fd, const char *, buf,
-                 vki_size_t, count, vki_loff_t, offset);
-   PRE_MEM_READ( "pwrite64(buf)", ARG2, ARG3 );
-}
-
-// The actual kernel definition of this routine takes a
-// single 64 bit offset argument. This version is for 32 bit
-// platforms only and treats the offset as two values - the
-// kernel relies on stack based argument passing conventions
-// to merge the two together.
-PRE(sys_pwrite64_on32bitplat)
-{
-   vg_assert(sizeof(UWord) == 4);
    *flags |= SfMayBlock;
+#if VG_WORDSIZE == 4
    PRINT("sys_pwrite64 ( %ld, %#lx, %llu, %lld )",
          ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
    PRE_REG_READ5(ssize_t, "pwrite64",
                  unsigned int, fd, const char *, buf, vki_size_t, count,
                  vki_u32, offset_low32, vki_u32, offset_high32);
+#elif VG_WORDSIZE == 8
+   PRINT("sys_pwrite64 ( %ld, %#lx, %llu, %lld )",
+         ARG1, ARG2, (ULong)ARG3, (Long)ARG4);
+   PRE_REG_READ4(ssize_t, "pwrite64",
+                 unsigned int, fd, const char *, buf, vki_size_t, count,
+                 Word, offset);
+#else
+#  error Unexpected word size
+#endif
    PRE_MEM_READ( "pwrite64(buf)", ARG2, ARG3 );
 }
 
@@ -2299,45 +2291,28 @@ PRE(sys_getsid)
    PRE_REG_READ1(long, "getsid", vki_pid_t, pid);
 }
 
-PRE(sys_pread64_on64bitplat)
-{
-   vg_assert(sizeof(UWord) == 8);
-   *flags |= SfMayBlock;
-   PRINT("sys_pread64 ( %ld, %#lx, %llu, %ld )",
-         ARG1, ARG2, (ULong)ARG3, ARG4);
-   PRE_REG_READ4(ssize_t, "pread64",
-                 unsigned int, fd, char *, buf,
-                 vki_size_t, count, vki_loff_t, offset);
-   PRE_MEM_WRITE( "pread64(buf)", ARG2, ARG3 );
-}
-POST(sys_pread64_on64bitplat)
-{
-   vg_assert(sizeof(UWord) == 8);
-   vg_assert(SUCCESS);
-   if (RES > 0) {
-      POST_MEM_WRITE( ARG2, RES );
-   }
-}
-
-// The actual kernel definition of this routine takes a
-// single 64 bit offset argument. This version is for 32 bit
-// platforms only and treats the offset as two values - the
-// kernel relies on stack based argument passing conventions
-// to merge the two together.
-PRE(sys_pread64_on32bitplat)
+PRE(sys_pread64)
 {
-   vg_assert(sizeof(UWord) == 4);
    *flags |= SfMayBlock;
+#if VG_WORDSIZE == 4
    PRINT("sys_pread64 ( %ld, %#lx, %llu, %lld )",
          ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
    PRE_REG_READ5(ssize_t, "pread64",
                  unsigned int, fd, char *, buf, vki_size_t, count,
                  vki_u32, offset_low32, vki_u32, offset_high32);
+#elif VG_WORDSIZE == 8
+   PRINT("sys_pread64 ( %ld, %#lx, %llu, %lld )",
+         ARG1, ARG2, (ULong)ARG3, (Long)ARG4);
+   PRE_REG_READ4(ssize_t, "pread64",
+                 unsigned int, fd, char *, buf, vki_size_t, count,
+                 Word, offset);
+#else
+#  error Unexpected word size
+#endif
    PRE_MEM_WRITE( "pread64(buf)", ARG2, ARG3 );
 }
-POST(sys_pread64_on32bitplat)
+POST(sys_pread64)
 {
-   vg_assert(sizeof(UWord) == 4);
    vg_assert(SUCCESS);
    if (RES > 0) {
       POST_MEM_WRITE( ARG2, RES );
index c2bd8e41bf4cffffef2b1d02e7993fcfb49de274..2575159eb7856e9b0b6d1db15fbfac68718e175c 100644 (file)
@@ -1710,8 +1710,8 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINXY(__NR_rt_sigqueueinfo,   sys_rt_sigqueueinfo),   // 177
    LINX_(__NR_rt_sigsuspend,     sys_rt_sigsuspend),     // 178
 
-   GENXY(__NR_pread64,           sys_pread64_on32bitplat),  // 179
-   GENX_(__NR_pwrite64,          sys_pwrite64_on32bitplat), // 180
+   GENXY(__NR_pread64,           sys_pread64),           // 179
+   GENX_(__NR_pwrite64,          sys_pwrite64),          // 180
    GENX_(__NR_chown,             sys_chown),             // 181
    GENXY(__NR_getcwd,            sys_getcwd),            // 182
    LINXY(__NR_capget,            sys_capget),            // 183
index dc82f4ac107d3b3c2b2f77e0ac7dae3e48232d72..dbf113b63b93a2b505f952b0640d7715ccc8ecc7 100644 (file)
@@ -1354,7 +1354,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINXY(__NR_rt_sigtimedwait,   sys_rt_sigtimedwait),    // 176
 // _____(__NR_rt_sigqueueinfo,   sys_rt_sigqueueinfo),    // 177
 // _____(__NR_rt_sigsuspend,     sys_rt_sigsuspend),      // 178
-   GENXY(__NR_pread64,           sys_pread64_on64bitplat), // 179
+   GENXY(__NR_pread64,           sys_pread64),            // 179
 
 // _____(__NR_pwrite64,          sys_pwrite64),           // 180
    GENX_(__NR_chown,             sys_chown),              // 181
index d72892ba5d371b9e573e77f98f46cdc6caac5900..e16b84488112b1bcfd0970852d7f2563b25bf1a2 100644 (file)
@@ -2055,8 +2055,8 @@ const SyscallTableEntry ML_(syscall_table)[] = {
    LINXY(__NR_rt_sigqueueinfo,   sys_rt_sigqueueinfo),// 178
    LINX_(__NR_rt_sigsuspend,     sys_rt_sigsuspend),  // 179
 
-   GENXY(__NR_pread64,           sys_pread64_on32bitplat),  // 180
-   GENX_(__NR_pwrite64,          sys_pwrite64_on32bitplat), // 181
+   GENXY(__NR_pread64,           sys_pread64),        // 180
+   GENX_(__NR_pwrite64,          sys_pwrite64),       // 181
    LINX_(__NR_chown,             sys_chown16),        // 182
    GENXY(__NR_getcwd,            sys_getcwd),         // 183
    LINXY(__NR_capget,            sys_capget),         // 184