DECL_TEMPLATE(amd64_linux, sys_shmdt);
DECL_TEMPLATE(amd64_linux, sys_shmctl);
DECL_TEMPLATE(amd64_linux, sys_arch_prctl);
+DECL_TEMPLATE(amd64_linux, sys_pread64);
+DECL_TEMPLATE(amd64_linux, sys_pwrite64);
PRE(sys_clone)
ML_(generic_POST_sys_shmctl)(tid, RES,ARG1,ARG2,ARG3);
}
+PRE(sys_pread64)
+{
+ *flags |= SfMayBlock;
+ PRINT("sys_pread64 ( %d, %p, %llu, %lld )",
+ 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 ( %d, %p, %llu, %lld )",
+ 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 );
+}
+
#undef PRE
#undef POST
PLAX_(__NR_rt_sigreturn, sys_rt_sigreturn), // 15
GENXY(__NR_ioctl, sys_ioctl), // 16
- GENXY(__NR_pread64, sys_pread64), // 17
- // (__NR_pwrite64, sys_pwrite64), // 18
+ PLAXY(__NR_pread64, sys_pread64), // 17
+ PLAX_(__NR_pwrite64, sys_pwrite64), // 18
GENXY(__NR_readv, sys_readv), // 19
GENX_(__NR_writev, sys_writev), // 20
PRE_REG_READ2(long, "setregid16", vki_old_gid_t, rgid, vki_old_gid_t, egid);
}
-// XXX: only for 32-bit archs
-#if defined(VGP_x86_linux)
+// 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)
{
*flags |= SfMayBlock;
vki_u32, offset_low32, vki_u32, offset_high32);
PRE_MEM_READ( "pwrite64(buf)", ARG2, ARG3 );
}
-#endif
PRE(sys_sync)
{
PRE_REG_READ1(long, "getsid", vki_pid_t, pid);
}
-// XXX: only for 32-bit archs
-// XXX even more: this in fact gets used by amd64-linux. Someone
-// should look into this properly.
+// 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)
{
*flags |= SfMayBlock;
//.. GENXY(__NR_rt_sigqueueinfo, sys_rt_sigqueueinfo), // 177
//.. GENX_(__NR_rt_sigsuspend, sys_rt_sigsuspend), // 178
//..
-//.. GENXY(__NR_pread64, sys_pread64), // 179
-//.. GENX_(__NR_pwrite64, sys_pwrite64), // 180
+ GENXY(__NR_pread64, sys_pread64), // 179
+ GENX_(__NR_pwrite64, sys_pwrite64), // 180
GENX_(__NR_chown, sys_chown16), // 181
//.. GENXY(__NR_getcwd, sys_getcwd), // 182
//.. GENXY(__NR_capget, sys_capget), // 183