- Use SizeT instead of UInt for new_mem_stack and all the related functions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2908
extern Int VG_(poll)( struct vki_pollfd *, UInt nfds, Int timeout);
/* system/mman.h */
-extern void* VG_(mmap)( void* start, UInt length, UInt prot, UInt flags,
+extern void* VG_(mmap)( void* start, SizeT length, UInt prot, UInt flags,
UInt sf_flags, UInt fd, UInt offset );
-extern Int VG_(munmap)( void* start, Int length );
-extern Int VG_(mprotect)( void *start, Int length, UInt prot );
+extern Int VG_(munmap)( void* start, SizeT length );
+extern Int VG_(mprotect)( void *start, SizeT length, UInt prot );
/* Move an fd into the Valgrind-safe range */
};
/* segment mapped from a file descriptor */
-extern void VG_(map_fd_segment) (Addr addr, UInt len, UInt prot, UInt flags,
+extern void VG_(map_fd_segment) (Addr addr, SizeT len, UInt prot, UInt flags,
Int fd, ULong off, const Char *filename);
/* segment mapped from a file */
-extern void VG_(map_file_segment)(Addr addr, UInt len, UInt prot, UInt flags,
+extern void VG_(map_file_segment)(Addr addr, SizeT len, UInt prot, UInt flags,
UInt dev, UInt ino, ULong off, const Char *filename);
/* simple segment */
-extern void VG_(map_segment) (Addr addr, UInt len, UInt prot, UInt flags);
+extern void VG_(map_segment) (Addr addr, SizeT len, UInt prot, UInt flags);
-extern void VG_(unmap_range) (Addr addr, UInt len);
-extern void VG_(mprotect_range)(Addr addr, UInt len, UInt prot);
-extern Addr VG_(find_map_space)(Addr base, UInt len, Bool for_client);
+extern void VG_(unmap_range) (Addr addr, SizeT len);
+extern void VG_(mprotect_range)(Addr addr, SizeT len, UInt prot);
+extern Addr VG_(find_map_space)(Addr base, SizeT len, Bool for_client);
extern Segment *VG_(find_segment)(Addr a);
extern Segment *VG_(first_segment)(void);
/* This unmaps all the segments in the range [addr, addr+len); any
partial mappings at the ends are truncated. */
-void VG_(unmap_range)(Addr addr, UInt len)
+void VG_(unmap_range)(Addr addr, SizeT len)
{
Segment *s;
Segment *next;
/* If possible, merge segment with its neighbours - some segments,
including s, may be destroyed in the process */
-static void merge_segments(Addr a, UInt len)
+static void merge_segments(Addr a, SizeT len)
{
Segment *s;
Segment *next;
}
}
-void VG_(map_file_segment)(Addr addr, UInt len, UInt prot, UInt flags,
+void VG_(map_file_segment)(Addr addr, SizeT len, UInt prot, UInt flags,
UInt dev, UInt ino, ULong off, const Char *filename)
{
Segment *s;
Bool recycled;
if (debug)
- VG_(printf)("map_file_segment(%p, %d, %x, %x, %4x, %d, %ld, %s)\n",
- addr, len, prot, flags, dev, ino, off, filename);
+ VG_(printf)("map_file_segment(%p, %llu, %x, %x, %4x, %d, %ld, %s)\n",
+ addr, (ULong)len, prot, flags, dev, ino, off, filename);
/* Everything must be page-aligned */
vg_assert((addr & (VKI_PAGE_SIZE-1)) == 0);
merge_segments(addr, len);
}
-void VG_(map_fd_segment)(Addr addr, UInt len, UInt prot, UInt flags,
+void VG_(map_fd_segment)(Addr addr, SizeT len, UInt prot, UInt flags,
Int fd, ULong off, const Char *filename)
{
struct vki_stat st;
VG_(arena_free)(VG_AR_CORE, name);
}
-void VG_(map_segment)(Addr addr, UInt len, UInt prot, UInt flags)
+void VG_(map_segment)(Addr addr, SizeT len, UInt prot, UInt flags)
{
flags &= ~SF_FILE;
}
/* set new protection flags on an address range */
-void VG_(mprotect_range)(Addr a, UInt len, UInt prot)
+void VG_(mprotect_range)(Addr a, SizeT len, UInt prot)
{
Segment *s, *next;
static const Bool debug = False || mem_debug;
merge_segments(a, len);
}
-Addr VG_(find_map_space)(Addr addr, UInt len, Bool for_client)
+Addr VG_(find_map_space)(Addr addr, SizeT len, Bool for_client)
{
static const Bool debug = False || mem_debug;
Segment *s;
return VG_(do_syscall)(__NR_munmap, (UInt)start, (UInt)length );
}
-static Addr mmap_inner(void *start, UInt length, UInt prot, UInt flags, UInt fd, UInt offset)
+static Addr mmap_inner(void *start, SizeT length, UInt prot, UInt flags, UInt fd, UInt offset)
{
Int ret;
}
/* Returns -1 on failure. */
-void* VG_(mmap)( void* start, UInt length,
+void* VG_(mmap)( void* start, SizeT length,
UInt prot, UInt flags, UInt sf_flags, UInt fd, UInt offset)
{
Addr res;
}
/* Returns -1 on failure. */
-Int VG_(munmap)( void* start, Int length )
+Int VG_(munmap)( void* start, SizeT length )
{
Int res = munmap_inner(start, length);
if (!VG_(is_kerror)(res))
return VG_(is_kerror)(res) ? -1 : 0;
}
-Int VG_(mprotect)( void *start, Int length, UInt prot )
+Int VG_(mprotect)( void *start, SizeT length, UInt prot )
{
- Int res = VG_(do_syscall)(__NR_mprotect, (UInt)start, (UInt)length, prot );
+ Int res = VG_(do_syscall)(__NR_mprotect, (UWord)start, length, prot );
if (!VG_(is_kerror)(res))
VG_(mprotect_range)((Addr)start, length, prot);
return VG_(is_kerror)(res) ? -1 : 0;
Primitive support for bagging memory via mmap.
------------------------------------------------------------------ */
-void* VG_(get_memory_from_mmap) ( Int nBytes, Char* who )
+void* VG_(get_memory_from_mmap) ( SizeT nBytes, Char* who )
{
- static UInt tot_alloc = 0;
+ static SizeT tot_alloc = 0;
void* p;
p = VG_(mmap)(0, nBytes,
VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC,
tot_alloc += (UInt)nBytes;
if (0)
VG_(printf)(
- "get_memory_from_mmap: %d tot, %d req = %p .. %p, caller %s\n",
- tot_alloc, nBytes, p, ((char*)p) + nBytes - 1, who );
+ "get_memory_from_mmap: %llu tot, %llu req = %p .. %p, caller %s\n",
+ (ULong)tot_alloc, (ULong)nBytes, p, ((char*)p) + nBytes - 1, who );
return p;
}
VG_(printf)("\n");
- VG_(printf)("VG_(get_memory_from_mmap): %s's request for %d bytes failed.\n",
- who, nBytes);
- VG_(printf)("VG_(get_memory_from_mmap): %d bytes already allocated.\n",
- tot_alloc);
+ VG_(printf)("VG_(get_memory_from_mmap): %s's request for %llu bytes failed.\n",
+ who, (ULong)nBytes);
+ VG_(printf)("VG_(get_memory_from_mmap): %llu bytes already allocated.\n",
+ (ULong)tot_alloc);
VG_(printf)("\n");
VG_(printf)("Sorry. You could try using a tool that uses less memory;\n");
VG_(printf)("eg. addrcheck instead of memcheck.\n");
// By choosing the right types, we can get these right for 32-bit and 64-bit
// platforms without having to do any conditional compilation or anything.
-//
+//
// Size in bits on: 32-bit archs 64-bit archs
// ------------ ------------
typedef unsigned char UChar; // 8 8
/* ------------------------------------------------------------------ */
/* Get memory by anonymous mmap. */
-extern void* VG_(get_memory_from_mmap) ( Int nBytes, Char* who );
+extern void* VG_(get_memory_from_mmap) ( SizeT nBytes, Char* who );
extern Bool VG_(is_client_addr) (Addr a);
extern Addr VG_(get_client_base)(void);
static Char buf2[BUF_LEN];
static Char buf3[BUF_LEN];
-static UInt sigstacks_space = 0; // Current signal stacks space sum
+static SizeT sigstacks_space = 0; // Current signal stacks space sum
static VgHashTable malloc_list = NULL; // HP_Chunks
/*--- Tracked events ---*/
/*------------------------------------------------------------*/
-static void new_mem_stack_signal(Addr a, UInt len)
+static void new_mem_stack_signal(Addr a, SizeT len)
{
sigstacks_space += len;
}
-static void die_mem_stack_signal(Addr a, UInt len)
+static void die_mem_stack_signal(Addr a, SizeT len)
{
sk_assert(sigstacks_space >= len);
sigstacks_space -= len;