Untested.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4844
// UNLESS YOU KNOW WHAT YOU ARE DOING.
SysRes VG_(am_do_mmap_NO_NOTIFY)( Addr start, SizeT length, UInt prot,
- 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 = VG_(do_syscall6)(__NR_mmap2, (UWord)start, length,
prot, flags, fd, offset / VKI_PAGE_SIZE);
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;
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));
/* Discard is needed if any of the just-trashed range had T. */
needDiscard = any_Ts_in_range( a, len );
segment array accordingly. */
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;
HChar buf[VKI_PATH_MAX];
/* Not allowable. */
- if (length == 0 || !VG_IS_PAGE_ALIGNED(start))
+ if (length == 0
+ || !VG_IS_PAGE_ALIGNED(start)
+ || !VG_IS_PAGE_ALIGNED(offset))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
/* Ask for an advisory. If it's negative, fail immediately. */
mapping in object files to read their debug info. */
SysRes VG_(am_mmap_file_float_valgrind) ( SizeT length, UInt prot,
- Int fd, SizeT offset )
+ Int fd, Off64T offset )
{
SysRes sres;
NSegment seg;
HChar buf[VKI_PATH_MAX];
/* Not allowable. */
- if (length == 0)
+ if (length == 0 || !VG_IS_PAGE_ALIGNED(offset))
return VG_(mk_SysRes_Error)( VKI_EINVAL );
/* Ask for an advisory. If it's negative, fail immediately. */
static Int readhex ( const Char* buf, UWord* val )
{
+ /* Read a word-sized hex number. */
+ Int n = 0;
+ *val = 0;
+ while (hexdigit(*buf) >= 0) {
+ *val = (*val << 4) + hexdigit(*buf);
+ n++; buf++;
+ }
+ return n;
+}
+
+static Int readhex64 ( const Char* buf, ULong* val )
+{
+ /* Read a potentially 64-bit hex number. */
Int n = 0;
*val = 0;
while (hexdigit(*buf) >= 0) {
UChar* filename;
UChar rr, ww, xx, pp, ch, tmp;
UInt ino, prot;
- UWord foffset, maj, min;
+ UWord maj, min;
+ ULong foffset;
read_procselfmaps_into_buf();
j = readchar(&procmap_buf[i], &ch);
if (j == 1 && ch == ' ') i += j; else goto syntaxerror;
- j = readhex(&procmap_buf[i], &foffset);
+ j = readhex64(&procmap_buf[i], &foffset);
if (j > 0) i += j; else goto syntaxerror;
j = readchar(&procmap_buf[i], &ch);
extern void ML_(generic_PRE_sys_shmctl) ( TId, UW, UW, UW );
extern void ML_(generic_POST_sys_shmctl) ( TId, UW, UW, UW, UW );
-extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, UW, UW );
+extern SysRes ML_(generic_PRE_sys_mmap) ( TId, UW, UW, UW, UW, UW, Off64T );
#undef TId
#undef UW
*/
void
ML_(notify_aspacem_and_tool_of_mmap) ( Addr a, SizeT len, UInt prot,
- UInt flags, Int fd, ULong offset )
+ UInt flags, Int fd, Off64T offset )
{
Bool rr, ww, xx, d;
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;
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
- r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 );
+ r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
+ (Off64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
- r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 * VKI_PAGE_SIZE );
+ r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
+ VKI_PAGE_SIZE * (Of64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
PRINT("old_mmap ( %p, %llu, %d, %d, %d, %d )",
a1, (ULong)a2, a3, a4, a5, a6 );
- r = ML_(generic_PRE_sys_mmap)( tid, a1, a2, a3, a4, a5, a6 );
+ r = ML_(generic_PRE_sys_mmap)( tid, a1, a2, a3, a4, a5, (Off64T)a6 );
SET_STATUS_from_SysRes(r);
}
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, offset);
- r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 * VKI_PAGE_SIZE );
+ r = ML_(generic_PRE_sys_mmap)( tid, ARG1, ARG2, ARG3, ARG4, ARG5,
+ VKI_PAGE_SIZE * (Off64T)ARG6 );
SET_STATUS_from_SysRes(r);
}
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 );
/* Notifies aspacem that an mprotect was completed successfully. The
segment array is updated accordingly. Note, as with
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 offset);
+ ( Addr start, SizeT length, UInt prot, UInt flags, UInt fd, Off64T offset);
//--------------------------------------------------------------
/* 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 );
/* Map anonymously at a fixed address for the client, and update
the segment array accordingly. */
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 );
/* Unmap the given address range and update the segment array
accordingly. This fails if the range isn't valid for the client.
typedef Word OffT; // 32 64
+typedef ULong Off64T; // 64 64
+
#if !defined(NULL)
# define NULL ((void*)0)
#endif