|
From: <sv...@va...> - 2009-12-02 16:19:28
|
Author: tom
Date: 2009-12-02 16:19:12 +0000 (Wed, 02 Dec 2009)
New Revision: 10962
Log:
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...
Modified:
trunk/coregrind/m_syswrap/syswrap-linux.c
Modified: trunk/coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-linux.c 2009-12-01 18:10:49 UTC (rev 10961)
+++ trunk/coregrind/m_syswrap/syswrap-linux.c 2009-12-02 16:19:12 UTC (rev 10962)
@@ -379,6 +379,7 @@
#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 @@
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 @@
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",
|