]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
64-bit cleanness:
authorNicholas Nethercote <n.nethercote@gmail.com>
Tue, 2 Nov 2004 13:29:50 +0000 (13:29 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Tue, 2 Nov 2004 13:29:50 +0000 (13:29 +0000)
- Use SizeT instead of UInt for new_mem_stack and all the related functions.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2908

coregrind/core.h
coregrind/vg_memory.c
coregrind/vg_mylibc.c
include/basic_types.h
include/tool.h.base
massif/ms_main.c

index 3c792f16e9c21347234b66c84e72e46ce272551a..d9583d55d363ad816a4ce7356186f512cc270973 100644 (file)
@@ -1012,10 +1012,10 @@ extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg );
 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 */
@@ -1308,19 +1308,19 @@ struct _Segment {
 };
 
 /* 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);
index 43915e18c535055c3a15f2ac69bfabd201577b55..e111dc7fbd1f003dae9e9b1e172909fd497cfdf0 100644 (file)
@@ -154,7 +154,7 @@ Segment *VG_(split_segment)(Addr a)
 
 /* 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;
@@ -281,7 +281,7 @@ static inline Bool neighbours(Segment *s1, Segment *s2)
 
 /* 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;
@@ -314,7 +314,7 @@ static void merge_segments(Addr a, UInt len)
    }
 }
 
-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;
@@ -322,8 +322,8 @@ void VG_(map_file_segment)(Addr addr, UInt len, UInt prot, UInt flags,
    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);
@@ -421,7 +421,7 @@ void VG_(map_file_segment)(Addr addr, UInt len, UInt prot, UInt flags,
    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;
@@ -449,7 +449,7 @@ void VG_(map_fd_segment)(Addr addr, UInt len, UInt prot, UInt flags,
       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;
 
@@ -457,7 +457,7 @@ void VG_(map_segment)(Addr addr, UInt len, UInt prot, UInt flags)
 }
 
 /* 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;
@@ -486,7 +486,7 @@ void VG_(mprotect_range)(Addr a, UInt len, UInt prot)
    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;
index 260afac7fbb76c753591a88098316517ec888397..77dcf2189b14d96160052af9842aeb05c85085dc 100644 (file)
@@ -273,7 +273,7 @@ static Int munmap_inner(void *start, UInt length)
    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;
    
@@ -284,7 +284,7 @@ static Addr mmap_inner(void *start, UInt length, UInt prot, UInt flags, UInt fd,
 }
 
 /* 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;
@@ -321,7 +321,7 @@ void* VG_(mmap)( void* start, UInt length,
 }
 
 /* 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))
@@ -329,9 +329,9 @@ Int VG_(munmap)( void* start, Int length )
    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;
@@ -1682,9 +1682,9 @@ UInt VG_(read_millisecond_timer) ( void )
    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,
@@ -1695,16 +1695,16 @@ void* VG_(get_memory_from_mmap) ( Int nBytes, Char* who )
       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");
index 01f38e31bac34f8b63639a25e53a9ac52704e0c3..4e8c769e3349293000b89d564b2671c8375137ec 100644 (file)
@@ -37,7 +37,7 @@
 
 // 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
index af7b351b638b30b9271e5b1a77a493d467ba6ecc..89d66ad008cf8a7aef170a63596f6b2cc7aa63e1 100644 (file)
@@ -485,7 +485,7 @@ extern void VG_(skin_assert_fail) ( const Char* expr, const Char* file,
 
 /* ------------------------------------------------------------------ */
 /* 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);
index ca3a28d0cc0b6381ab6243aaecdb4813ba4b6375..fdb39d04f8368651f185e266d9d540e9c5b2462d 100644 (file)
@@ -244,7 +244,7 @@ static Char buf [BUF_LEN];
 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
 
@@ -1113,12 +1113,12 @@ static void hp_census(void)
 /*--- 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;