From: Tom Hughes Date: Wed, 2 Dec 2009 16:19:12 +0000 (+0000) Subject: It seems whoever wrote the preadv and pwritev system calls in the X-Git-Tag: svn/VALGRIND_3_6_0~454 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=798cd12a34b3ba0df72cf56e5ddf4b337a4b8275;p=thirdparty%2Fvalgrind.git It seems whoever wrote the preadv and pwritev system calls in the kernel decided it would be fun to make them always take the low word of the offset argument before the high word regardless of the endianism of the system... Consistency - they've heard of it... git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10962 --- diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index b71e777546..c8c44aab64 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -379,6 +379,7 @@ SysRes ML_(do_fork_clone) ( ThreadId tid, UInt flags, #define POST(name) DEFN_POST_TEMPLATE(linux, name) // Macros to support 64-bit syscall args split into two 32 bit values +#define LOHI64(lo,hi) ( ((ULong)(lo)) | (((ULong)(hi)) << 32) ) #if defined(VG_LITTLEENDIAN) #define MERGE64(lo,hi) ( ((ULong)(lo)) | (((ULong)(hi)) << 32) ) #define MERGE64_FIRST(name) name##_low @@ -3161,11 +3162,13 @@ PRE(sys_preadv) struct vki_iovec * vec; *flags |= SfMayBlock; #if VG_WORDSIZE == 4 - PRINT("sys_preadv ( %ld, %#lx, %llu, %lld )",ARG1,ARG2,(ULong)ARG3,MERGE64(ARG4,ARG5)); + /* Note that the offset argument here is in lo+hi order on both + big and little endian platforms... */ + PRINT("sys_preadv ( %ld, %#lx, %llu, %lld )",ARG1,ARG2,(ULong)ARG3,LOHI64(ARG4,ARG5)); PRE_REG_READ5(ssize_t, "preadv", unsigned long, fd, const struct iovec *, vector, - unsigned long, count, vki_u32, MERGE64_FIRST(offset), - vki_u32, MERGE64_SECOND(offset)); + unsigned long, count, vki_u32, offset_low, + vki_u32, offset_high); #elif VG_WORDSIZE == 8 PRINT("sys_preadv ( %ld, %#lx, %llu, %lld )",ARG1,ARG2,(ULong)ARG3,(Long)ARG4); PRE_REG_READ4(ssize_t, "preadv", @@ -3214,11 +3217,13 @@ PRE(sys_pwritev) struct vki_iovec * vec; *flags |= SfMayBlock; #if VG_WORDSIZE == 4 - PRINT("sys_pwritev ( %ld, %#lx, %llu, %lld )",ARG1,ARG2,(ULong)ARG3,MERGE64(ARG4,ARG5)); + /* Note that the offset argument here is in lo+hi order on both + big and little endian platforms... */ + PRINT("sys_pwritev ( %ld, %#lx, %llu, %lld )",ARG1,ARG2,(ULong)ARG3,LOHI64(ARG4,ARG5)); PRE_REG_READ5(ssize_t, "pwritev", unsigned long, fd, const struct iovec *, vector, - unsigned long, count, vki_u32, MERGE64_FIRST(offset), - vki_u32, MERGE64_SECOND(offset)); + unsigned long, count, vki_u32, offset_low, + vki_u32, offset_high); #elif VG_WORDSIZE == 8 PRINT("sys_pwritev ( %ld, %#lx, %llu, %lld )",ARG1,ARG2,(ULong)ARG3,(Long)ARG4); PRE_REG_READ4(ssize_t, "pwritev",