|
From: <sv...@va...> - 2005-10-02 17:01:48
|
Author: sewardj
Date: 2005-10-02 18:01:41 +0100 (Sun, 02 Oct 2005)
New Revision: 4844
Log:
Plumb 64-bit file offsets throughout the address space manager.
Untested.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
trunk/coregrind/m_syswrap/priv_syswrap-generic.h
trunk/coregrind/m_syswrap/syswrap-generic.c
trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c
trunk/coregrind/m_syswrap/syswrap-x86-linux.c
trunk/coregrind/pub_core_aspacemgr.h
trunk/include/pub_tool_basics.h
Modified: trunk/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-10-02 14:48:09 UTC (rev =
4843)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2005-10-02 17:01:41 UTC (rev =
4844)
@@ -225,9 +225,10 @@
// UNLESS YOU KNOW WHAT YOU ARE DOING.
=20
SysRes VG_(am_do_mmap_NO_NOTIFY)( Addr start, SizeT length, UInt prot,=20
- UInt flags, UInt fd, OffT offset)
+ UInt flags, UInt fd, Off64T offset)
{
SysRes res;
+ aspacem_assert(VG_IS_PAGE_ALIGNED(offset));
# if defined(VGP_x86_linux) || defined(VGP_ppc32_linux)
res =3D VG_(do_syscall6)(__NR_mmap2, (UWord)start, length,
prot, flags, fd, offset / VKI_PAGE_SIZE);
@@ -1785,7 +1786,7 @@
=20
Bool
VG_(am_notify_client_mmap)( Addr a, SizeT len, UInt prot, UInt flags,
- Int fd, SizeT offset )
+ Int fd, Off64T offset )
{
HChar buf[VKI_PATH_MAX];
UInt dev, ino;
@@ -1795,6 +1796,7 @@
aspacem_assert(len > 0);
aspacem_assert(VG_IS_PAGE_ALIGNED(a));
aspacem_assert(VG_IS_PAGE_ALIGNED(len));
+ aspacem_assert(VG_IS_PAGE_ALIGNED(offset));
=20
/* Discard is needed if any of the just-trashed range had T. */
needDiscard =3D any_Ts_in_range( a, len );
@@ -1921,7 +1923,7 @@
segment array accordingly. */
=20
SysRes VG_(am_mmap_file_fixed_client)
- ( Addr start, SizeT length, UInt prot, Int fd, SizeT offset )
+ ( Addr start, SizeT length, UInt prot, Int fd, Off64T offset )
{
SysRes sres;
NSegment seg;
@@ -1932,7 +1934,9 @@
HChar buf[VKI_PATH_MAX];
=20
/* Not allowable. */
- if (length =3D=3D 0 || !VG_IS_PAGE_ALIGNED(start))
+ if (length =3D=3D 0=20
+ || !VG_IS_PAGE_ALIGNED(start)
+ || !VG_IS_PAGE_ALIGNED(offset))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* Ask for an advisory. If it's negative, fail immediately. */
@@ -2172,7 +2176,7 @@
mapping in object files to read their debug info. */
=20
SysRes VG_(am_mmap_file_float_valgrind) ( SizeT length, UInt prot,=20
- Int fd, SizeT offset )
+ Int fd, Off64T offset )
{
SysRes sres;
NSegment seg;
@@ -2183,7 +2187,7 @@
HChar buf[VKI_PATH_MAX];
=20
/* Not allowable. */
- if (length =3D=3D 0)
+ if (length =3D=3D 0 || !VG_IS_PAGE_ALIGNED(offset))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
=20
/* Ask for an advisory. If it's negative, fail immediately. */
@@ -2791,6 +2795,7 @@
=20
static Int readhex ( const Char* buf, UWord* val )
{
+ /* Read a word-sized hex number. */
Int n =3D 0;
*val =3D 0;
while (hexdigit(*buf) >=3D 0) {
@@ -2800,6 +2805,18 @@
return n;
}
=20
+static Int readhex64 ( const Char* buf, ULong* val )
+{
+ /* Read a potentially 64-bit hex number. */
+ Int n =3D 0;
+ *val =3D 0;
+ while (hexdigit(*buf) >=3D 0) {
+ *val =3D (*val << 4) + hexdigit(*buf);
+ n++; buf++;
+ }
+ return n;
+}
+
static Int readdec ( const Char* buf, UInt* val )
{
Int n =3D 0;
@@ -2877,7 +2894,8 @@
UChar* filename;
UChar rr, ww, xx, pp, ch, tmp;
UInt ino, prot;
- UWord foffset, maj, min;
+ UWord maj, min;
+ ULong foffset;
=20
read_procselfmaps_into_buf();
=20
@@ -2917,7 +2935,7 @@
j =3D readchar(&procmap_buf[i], &ch);
if (j =3D=3D 1 && ch =3D=3D ' ') i +=3D j; else goto syntaxerror;
=20
- j =3D readhex(&procmap_buf[i], &foffset);
+ j =3D readhex64(&procmap_buf[i], &foffset);
if (j > 0) i +=3D j; else goto syntaxerror;
=20
j =3D readchar(&procmap_buf[i], &ch);
Modified: trunk/coregrind/m_syswrap/priv_syswrap-generic.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/priv_syswrap-generic.h 2005-10-02 14:48:09 =
UTC (rev 4843)
+++ trunk/coregrind/m_syswrap/priv_syswrap-generic.h 2005-10-02 17:01:41 =
UTC (rev 4844)
@@ -242,7 +242,7 @@
extern void ML_(generic_PRE_sys_shmctl) ( TId, UW, UW, UW );
extern void ML_(generic_POST_sys_shmctl) ( TId, UW, UW, UW, UW );
=20
-extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, U=
W, UW );
+extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, U=
W, Off64T );
=20
#undef TId
#undef UW
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2005-10-02 14:48:09 UTC (=
rev 4843)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2005-10-02 17:01:41 UTC (=
rev 4844)
@@ -143,7 +143,7 @@
*/
void=20
ML_(notify_aspacem_and_tool_of_mmap) ( Addr a, SizeT len, UInt prot,=20
- UInt flags, Int fd, ULong offset =
)
+ UInt flags, Int fd, Off64T offset=
)
{
Bool rr, ww, xx, d;
=20
@@ -1741,7 +1741,7 @@
SysRes
ML_(generic_PRE_sys_mmap) ( ThreadId tid,
UWord arg1, UWord arg2, UWord arg3,
- UWord arg4, UWord arg5, UWord arg6 )
+ UWord arg4, UWord arg5, Off64T arg6 )
{
Addr advised;
SysRes sres;
Modified: trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c 2005-10-02 14:48:09 U=
TC (rev 4843)
+++ trunk/coregrind/m_syswrap/syswrap-ppc32-linux.c 2005-10-02 17:01:41 U=
TC (rev 4844)
@@ -869,7 +869,8 @@
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
=20
- r =3D ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, A=
RG6 );
+ r =3D ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,=20
+ (Off64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
=20
@@ -887,7 +888,8 @@
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
=20
- r =3D ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, A=
RG6 * VKI_PAGE_SIZE );
+ r =3D ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,=20
+ VKI_PAGE_SIZE * (Of64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
=20
Modified: trunk/coregrind/m_syswrap/syswrap-x86-linux.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2005-10-02 14:48:09 UTC=
(rev 4843)
+++ trunk/coregrind/m_syswrap/syswrap-x86-linux.c 2005-10-02 17:01:41 UTC=
(rev 4844)
@@ -1483,7 +1483,7 @@
PRINT("old_mmap ( %p, %llu, %d, %d, %d, %d )",
a1, (ULong)a2, a3, a4, a5, a6 );
=20
- r =3D ML_(generic_PRE_sys_mmap)( tid, a1, a2, a3, a4, a5, a6 );
+ r =3D ML_(generic_PRE_sys_mmap)( tid, a1, a2, a3, a4, a5, (Off64T)a6 =
);
SET_STATUS_from_SysRes(r);
}
=20
@@ -1502,7 +1502,8 @@
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
=20
- r =3D ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, A=
RG6 * VKI_PAGE_SIZE );
+ r =3D ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,=20
+ VKI_PAGE_SIZE * (Off64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
=20
Modified: trunk/coregrind/pub_core_aspacemgr.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_aspacemgr.h 2005-10-02 14:48:09 UTC (rev 484=
3)
+++ trunk/coregrind/pub_core_aspacemgr.h 2005-10-02 17:01:41 UTC (rev 484=
4)
@@ -153,7 +153,7 @@
True, the caller should immediately discard translations from the
specified address range. */
extern Bool VG_(am_notify_client_mmap)
- ( Addr a, SizeT len, UInt prot, UInt flags, Int fd, SizeT offset );
+ ( Addr a, SizeT len, UInt prot, UInt flags, Int fd, Off64T offset );
=20
/* Notifies aspacem that an mprotect was completed successfully. The
segment array is updated accordingly. Note, as with
@@ -181,7 +181,7 @@
USE IT UNLESS YOU UNDERSTAND the request-notify model used by
aspacem. In short, DO NOT USE THIS FUNCTION. */
extern SysRes VG_(am_do_mmap_NO_NOTIFY)
- ( Addr start, SizeT length, UInt prot, UInt flags, UInt fd, OffT offs=
et);
+ ( Addr start, SizeT length, UInt prot, UInt flags, UInt fd, Off64T of=
fset);
=20
=20
//--------------------------------------------------------------
@@ -195,7 +195,7 @@
/* Map a file at a fixed address for the client, and update the
segment array accordingly. */
extern SysRes VG_(am_mmap_file_fixed_client)
- ( Addr start, SizeT length, UInt prot, Int fd, SizeT offset );
+ ( Addr start, SizeT length, UInt prot, Int fd, Off64T offset );
=20
/* Map anonymously at a fixed address for the client, and update
the segment array accordingly. */
@@ -215,7 +215,7 @@
segment array accordingly. This is used by V for transiently
mapping in object files to read their debug info. */
extern SysRes VG_(am_mmap_file_float_valgrind)
- ( SizeT length, UInt prot, Int fd, SizeT offset );
+ ( SizeT length, UInt prot, Int fd, Off64T offset );
=20
/* Unmap the given address range and update the segment array
accordingly. This fails if the range isn't valid for the client.
Modified: trunk/include/pub_tool_basics.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/include/pub_tool_basics.h 2005-10-02 14:48:09 UTC (rev 4843)
+++ trunk/include/pub_tool_basics.h 2005-10-02 17:01:41 UTC (rev 4844)
@@ -81,6 +81,8 @@
=20
typedef Word OffT; // 32 64
=20
+typedef ULong Off64T; // 64 64
+
#if !defined(NULL)
# define NULL ((void*)0)
#endif
|