]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Tidy up the wrappers for pread64 and pwrite64, and make these two
authorJulian Seward <jseward@acm.org>
Thu, 7 Aug 2008 20:29:55 +0000 (20:29 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 7 Aug 2008 20:29:55 +0000 (20:29 +0000)
syscalls available on ppc64-linux.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8519

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 8a9493c579874e04e1d9f9e2e22a1a75c1163504..e673a0d921871e617e2f8fea9cd76c337a3cbc69 100644 (file)
@@ -178,8 +178,10 @@ 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);               // * (Unix98?)
-DECL_TEMPLATE(generic, sys_pwrite64);              // * (Unix98?)
+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_sigaltstack);           // (x86) (XPG4-UNIX)
 DECL_TEMPLATE(generic, sys_getpmsg);               // (?) (?)
 DECL_TEMPLATE(generic, sys_putpmsg);               // (?) (?)
index df98cc9a8ab290471e43f7450d2d9e634e8e2e7c..73ea0c632d50328e86a0ee741214e4033412dcec 100644 (file)
@@ -371,8 +371,6 @@ DECL_TEMPLATE(amd64_linux, sys_shmdt);
 DECL_TEMPLATE(amd64_linux, sys_shmctl);
 DECL_TEMPLATE(amd64_linux, sys_arch_prctl);
 DECL_TEMPLATE(amd64_linux, sys_ptrace);
-DECL_TEMPLATE(amd64_linux, sys_pread64);
-DECL_TEMPLATE(amd64_linux, sys_pwrite64);
 DECL_TEMPLATE(amd64_linux, sys_fadvise64);
 DECL_TEMPLATE(amd64_linux, sys_mmap);
 DECL_TEMPLATE(amd64_linux, sys_syscall184);
@@ -939,35 +937,6 @@ POST(sys_shmctl)
    ML_(generic_POST_sys_shmctl)(tid, RES,ARG1,ARG2,ARG3);
 }
 
-PRE(sys_pread64)
-{
-   *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)
-{
-   vg_assert(SUCCESS);
-   if (RES > 0) {
-      POST_MEM_WRITE( ARG2, RES );
-   }
-}
-
-PRE(sys_pwrite64)
-{
-   *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 );
-}
-
 PRE(sys_fadvise64)
 {
    PRINT("sys_fadvise64 ( %ld, %ld, %lu, %ld )", ARG1,ARG2,ARG3,ARG4);
@@ -1066,8 +1035,8 @@ const SyscallTableEntry ML_(syscall_table)[] = {
 
    PLAX_(__NR_rt_sigreturn,      sys_rt_sigreturn),   // 15 
    GENXY(__NR_ioctl,             sys_ioctl),          // 16 
-   PLAXY(__NR_pread64,           sys_pread64),        // 17 
-   PLAX_(__NR_pwrite64,          sys_pwrite64),       // 18 
+   GENXY(__NR_pread64,           sys_pread64_on64bitplat),  // 17 
+   GENX_(__NR_pwrite64,          sys_pwrite64_on64bitplat), // 18 
    GENXY(__NR_readv,             sys_readv),          // 19 
 
    GENX_(__NR_writev,            sys_writev),         // 20 
index ffd64e36d1acb95ad65f149f237c66e05a72bb99..51ab4fe36b2a0f76b92dfbd20a722d9265b3a15d 100644 (file)
@@ -2250,13 +2250,26 @@ PRE(sys_getpriority)
    PRE_REG_READ2(long, "getpriority", int, which, int, who);
 }
 
+PRE(sys_pwrite64_on64bitplat)
+{
+   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)
+PRE(sys_pwrite64_on32bitplat)
 {
+   vg_assert(sizeof(UWord) == 4);
    *flags |= SfMayBlock;
    PRINT("sys_pwrite64 ( %ld, %#lx, %llu, %lld )",
          ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
@@ -2304,13 +2317,34 @@ 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)
+PRE(sys_pread64_on32bitplat)
 {
+   vg_assert(sizeof(UWord) == 4);
    *flags |= SfMayBlock;
    PRINT("sys_pread64 ( %ld, %#lx, %llu, %lld )",
          ARG1, ARG2, (ULong)ARG3, LOHI64(ARG4,ARG5));
@@ -2319,8 +2353,9 @@ PRE(sys_pread64)
                  vki_u32, offset_low32, vki_u32, offset_high32);
    PRE_MEM_WRITE( "pread64(buf)", ARG2, ARG3 );
 }
-POST(sys_pread64)
+POST(sys_pread64_on32bitplat)
 {
+   vg_assert(sizeof(UWord) == 4);
    vg_assert(SUCCESS);
    if (RES > 0) {
       POST_MEM_WRITE( ARG2, RES );
index 861b5e3aa5472b532f44f92e909f5b78351b7679..c2e056d6d5a3c11dafacf1909ab025a77fd899fa 100644 (file)
@@ -1687,8 +1687,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),           // 179
-   GENX_(__NR_pwrite64,          sys_pwrite64),          // 180
+   GENXY(__NR_pread64,           sys_pread64_on32bitplat),  // 179
+   GENX_(__NR_pwrite64,          sys_pwrite64_on32bitplat), // 180
    GENX_(__NR_chown,             sys_chown),             // 181
    GENXY(__NR_getcwd,            sys_getcwd),            // 182
 //..    LINXY(__NR_capget,            sys_capget),            // 183
index f08ef313628176c166109b7bb04becd2f3723e82..1aae5e2a7a41b4f9d5232f6d082b15ccdbb9c57a 100644 (file)
@@ -1260,7 +1260,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
 // _____(__NR_profil,            sys_profil),             //  98
    GENXY(__NR_statfs,            sys_statfs),             //  99
 
-// _____(__NR_fstatfs,           sys_fstatfs),            // 100
+   GENXY(__NR_fstatfs,           sys_fstatfs),            // 100
 // _____(__NR_ioperm,            sys_ioperm),             // 101
    PLAXY(__NR_socketcall,        sys_socketcall),         // 102
    LINXY(__NR_syslog,            sys_syslog),             // 103
@@ -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
-// _____(__NR_pread64,           sys_pread64),            // 179
+   GENXY(__NR_pread64,           sys_pread64_on64bitplat), // 179
 
 // _____(__NR_pwrite64,          sys_pwrite64),           // 180
    GENX_(__NR_chown,             sys_chown),              // 181
@@ -1382,7 +1382,7 @@ const SyscallTableEntry ML_(syscall_table)[] = {
 
 // _____(__NR_pciconfig_iobase,  sys_pciconfig_iobase),   // 200
 // _____(__NR_multiplexer,       sys_multiplexer),        // 201
-// _____(__NR_getdents64,        sys_getdents64),         // 202
+   GENXY(__NR_getdents64,        sys_getdents64),         // 202
 // _____(__NR_pivot_root,        sys_pivot_root),         // 203
    GENXY(__NR_fcntl64,           sys_fcntl64),            // 204 !!!!?? 32bit only */
 
index 196f07f8a67382b0ef2740d1fb0e0e8d7d8ba2df..3eb077a5ed735479213f0421b43995ac8196fa04 100644 (file)
@@ -2057,8 +2057,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),        // 180
-   GENX_(__NR_pwrite64,          sys_pwrite64),       // 181
+   GENXY(__NR_pread64,           sys_pread64_on32bitplat),  // 180
+   GENX_(__NR_pwrite64,          sys_pwrite64_on32bitplat), // 181
    LINX_(__NR_chown,             sys_chown16),        // 182
    GENXY(__NR_getcwd,            sys_getcwd),         // 183
    LINXY(__NR_capget,            sys_capget),         // 184