|
From: <sv...@va...> - 2009-05-24 23:02:59
|
Author: njn
Date: 2009-05-25 00:02:55 +0100 (Mon, 25 May 2009)
New Revision: 10134
Log:
DARWIN sync: sys_truncate64 and sys_ftruncate64 wrappers.
Modified:
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2009-05-24 22:45:33 UTC (rev 10133)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2009-05-24 23:02:55 UTC (rev 10134)
@@ -2001,8 +2001,11 @@
#define PRE(name) DEFN_PRE_TEMPLATE(generic, name)
#define POST(name) DEFN_POST_TEMPLATE(generic, name)
+#if VG_WORDSIZE == 4
// Combine two 32-bit values into a 64-bit value
+// Always use with low-numbered arg first (e.g. LOHI64(ARG1,ARG2) )
#define LOHI64(lo,hi) ( ((ULong)(lo)) | (((ULong)(hi)) << 32) )
+#endif
PRE(sys_exit)
{
@@ -2853,30 +2856,36 @@
PRE_MEM_RASCIIZ( "truncate(path)", ARG1 );
}
-// XXX: this wrapper is only suitable for 32-bit platforms
-#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux)
PRE(sys_ftruncate64)
{
*flags |= SfMayBlock;
+#if VG_WORDSIZE == 4
PRINT("sys_ftruncate64 ( %ld, %lld )", ARG1, LOHI64(ARG2,ARG3));
PRE_REG_READ3(long, "ftruncate64",
unsigned int, fd,
- vki_u32, length_low32, vki_u32, length_high32);
+ UWord, length_low32, UWord, length_high32);
+#else
+ PRINT("sys_ftruncate64 ( %ld, %lld )", ARG1, (Long)ARG2);
+ PRE_REG_READ2(long, "ftruncate64",
+ unsigned int,fd, UWord,length);
+#endif
}
-#endif
-// XXX: this wrapper is only suitable for 32-bit platforms
-#if defined(VGP_x86_linux) || defined(VGP_ppc32_linux)
PRE(sys_truncate64)
{
*flags |= SfMayBlock;
- PRINT("sys_truncate64 ( %#lx, %lld )", ARG1, LOHI64(ARG2, ARG3));
+#if VG_WORDSIZE == 4
+ PRINT("sys_truncate64 ( %#lx, %lld )", ARG1, (Long)LOHI64(ARG2, ARG3));
PRE_REG_READ3(long, "truncate64",
const char *, path,
- vki_u32, length_low32, vki_u32, length_high32);
+ UWord, length_low32, UWord, length_high32);
+#else
+ PRINT("sys_truncate64 ( %#lx, %lld )", ARG1, (Long)ARG2);
+ PRE_REG_READ2(long, "truncate64",
+ const char *,path, UWord,length);
+#endif
PRE_MEM_RASCIIZ( "truncate64(path)", ARG1 );
}
-#endif
PRE(sys_getdents)
{
@@ -3006,7 +3015,7 @@
case VKI_RLIMIT_STACK:
*((struct vki_rlimit *)a2) = VG_(client_rlimit_stack);
break;
- }
+ }
}
PRE(sys_old_getrlimit)
|