- Use SizeT instead of UInt for new_mem_stack and all the related functions.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2907
/*------------------------------------------------------------*/
static /* __inline__ */
-void set_address_range_perms ( Addr a, UInt len,
- UInt example_a_bit )
+void set_address_range_perms ( Addr a, SizeT len, UInt example_a_bit )
{
UChar abyte8;
UInt sm_off;
/* Set permissions for address ranges ... */
-static void ac_make_noaccess ( Addr a, UInt len )
+static void ac_make_noaccess ( Addr a, SizeT len )
{
PROF_EVENT(35);
DEBUG("ac_make_noaccess(%p, %x)\n", a, len);
set_address_range_perms ( a, len, VGM_BIT_INVALID );
}
-static void ac_make_accessible ( Addr a, UInt len )
+static void ac_make_accessible ( Addr a, SizeT len )
{
PROF_EVENT(38);
DEBUG("ac_make_accessible(%p, %x)\n", a, len);
/* Block-copy permissions (needed for implementing realloc()). */
-static void ac_copy_address_range_state ( Addr src, Addr dst, UInt len )
+static void ac_copy_address_range_state ( Addr src, Addr dst, SizeT len )
{
UInt i;
know what it is. */
static __inline__
-Bool ac_check_accessible ( Addr a, UInt len, Addr* bad_addr )
+Bool ac_check_accessible ( Addr a, SizeT len, Addr* bad_addr )
{
UInt i;
UChar abit;
/* The opposite; check that an address range is inaccessible. */
static
-Bool ac_check_noaccess ( Addr a, UInt len, Addr* bad_addr )
+Bool ac_check_noaccess ( Addr a, SizeT len, Addr* bad_addr )
{
UInt i;
UChar abit;
static __inline__
void ac_check_is_accessible ( CorePart part, ThreadId tid,
- Char* s, Addr base, UInt size, Bool isWrite )
+ Char* s, Addr base, SizeT size, Bool isWrite )
{
Bool ok;
Addr bad_addr;
static
void ac_check_is_writable ( CorePart part, ThreadId tid,
- Char* s, Addr base, UInt size )
+ Char* s, Addr base, SizeT size )
{
ac_check_is_accessible ( part, tid, s, base, size, /*isWrite*/True );
}
static
void ac_check_is_readable ( CorePart part, ThreadId tid,
- Char* s, Addr base, UInt size )
+ Char* s, Addr base, SizeT size )
{
ac_check_is_accessible ( part, tid, s, base, size, /*isWrite*/False );
}
}
static
-void ac_new_mem_startup( Addr a, UInt len, Bool rr, Bool ww, Bool xx )
+void ac_new_mem_startup( Addr a, SizeT len, Bool rr, Bool ww, Bool xx )
{
/* Ignore the permissions, just make it readable. Seems to work... */
DEBUG("new_mem_startup(%p, %u, rr=%u, ww=%u, xx=%u)\n", a,len,rr,ww,xx);
}
static
-void ac_new_mem_heap ( Addr a, UInt len, Bool is_inited )
+void ac_new_mem_heap ( Addr a, SizeT len, Bool is_inited )
{
ac_make_accessible(a, len);
}
static
-void ac_set_perms (Addr a, UInt len, Bool rr, Bool ww, Bool xx)
+void ac_set_perms (Addr a, SizeT len, Bool rr, Bool ww, Bool xx)
{
DEBUG("ac_set_perms(%p, %u, rr=%u ww=%u, xx=%u)\n",
a, len, rr, ww, xx);
## malloc() et al. See above how to do this.)
## These ones occur at startup, upon some signals, and upon some syscalls
-void, new_mem_startup, Addr a, UInt len, Bool rr, Bool ww, Bool xx
-void, new_mem_stack_signal, Addr a, UInt len
-void, new_mem_brk, Addr a, UInt len
-void, new_mem_mmap, Addr a, UInt len, Bool rr, Bool ww, Bool xx
+void, new_mem_startup, Addr a, SizeT len, Bool rr, Bool ww, Bool xx
+void, new_mem_stack_signal, Addr a, SizeT len
+void, new_mem_brk, Addr a, SizeT len
+void, new_mem_mmap, Addr a, SizeT len, Bool rr, Bool ww, Bool xx
-void, copy_mem_remap, Addr from, Addr to, UInt len
-void, change_mem_mprotect, Addr a, UInt len, Bool rr, Bool ww, Bool xx
-void, die_mem_stack_signal, Addr a, UInt len
-void, die_mem_brk, Addr a, UInt len
-void, die_mem_munmap, Addr a, UInt len
+void, copy_mem_remap, Addr from, Addr to, SizeT len
+void, change_mem_mprotect, Addr a, SizeT len, Bool rr, Bool ww, Bool xx
+void, die_mem_stack_signal, Addr a, SizeT len
+void, die_mem_brk, Addr a, SizeT len
+void, die_mem_munmap, Addr a, SizeT len
## These ones are called when %esp changes. A tool could track these itself
## (except for ban_mem_stack) but it's much easier to use the core's help.
void, new_mem_stack_12, Addr new_ESP
void, new_mem_stack_16, Addr new_ESP
void, new_mem_stack_32, Addr new_ESP
-void, new_mem_stack, Addr a, UInt len
+void, new_mem_stack, Addr a, SizeT len
void, die_mem_stack_4, Addr die_ESP
void, die_mem_stack_8, Addr die_ESP
void, die_mem_stack_12, Addr die_ESP
void, die_mem_stack_16, Addr die_ESP
void, die_mem_stack_32, Addr die_ESP
-void, die_mem_stack, Addr a, UInt len
+void, die_mem_stack, Addr a, SizeT len
## Used for redzone at end of thread stacks
-void, ban_mem_stack, Addr a, UInt len
+void, ban_mem_stack, Addr a, SizeT len
## These ones occur around syscalls, signal handling, etc
-void, pre_mem_read, CorePart part, ThreadId tid, Char* s, Addr a, UInt size
+void, pre_mem_read, CorePart part, ThreadId tid, Char* s, Addr a, SizeT size
void, pre_mem_read_asciiz, CorePart part, ThreadId tid, Char* s, Addr a
-void, pre_mem_write, CorePart part, ThreadId tid, Char* s, Addr a, UInt size
+void, pre_mem_write, CorePart part, ThreadId tid, Char* s, Addr a, SizeT size
## Not implemented yet -- have to add in lots of places, which is a
## pain. Won't bother unless/until there's a need.
-## void (*post_mem_read) ( ThreadState* tst, Char* s, Addr a, UInt size );
-void, post_mem_write, Addr a, UInt size
+## void (*post_mem_read) ( ThreadState* tst, Char* s, Addr a, SizeT size );
+void, post_mem_write, Addr a, SizeT size
## Register events -- if `shadow_regs' need is set, all should probably be
}
static
-void set_address_range_state ( Addr a, UInt len /* in bytes */,
+void set_address_range_state ( Addr a, SizeT len /* in bytes */,
VgeInitStatus status )
{
Addr end;
}
-static void make_segment_readable ( Addr a, UInt len )
+static void make_segment_readable ( Addr a, SizeT len )
{
//PROF_EVENT(??); PPP
set_address_range_state ( a, len, Vge_SegmentInit );
}
-static void make_writable ( Addr a, UInt len )
+static void make_writable ( Addr a, SizeT len )
{
//PROF_EVENT(36); PPP
set_address_range_state( a, len, Vge_VirginInit );
}
-static void make_readable ( Addr a, UInt len )
+static void make_readable ( Addr a, SizeT len )
{
//PROF_EVENT(37); PPP
set_address_range_state( a, len, Vge_VirginInit );
/* Block-copy states (needed for implementing realloc()). */
-static void copy_address_range_state(Addr src, Addr dst, UInt len)
+static void copy_address_range_state(Addr src, Addr dst, SizeT len)
{
UInt i;
}
// SSS: put these somewhere better
-static void eraser_mem_read (Addr a, UInt data_size, ThreadId tid);
-static void eraser_mem_write(Addr a, UInt data_size, ThreadId tid);
+static void eraser_mem_read (Addr a, SizeT data_size, ThreadId tid);
+static void eraser_mem_write(Addr a, SizeT data_size, ThreadId tid);
static void eraser_mem_help_read_1(Addr a) REGPARM(1);
static void eraser_mem_help_read_2(Addr a) REGPARM(1);
static void eraser_mem_help_read_4(Addr a) REGPARM(1);
-static void eraser_mem_help_read_N(Addr a, UInt size) REGPARM(2);
+static void eraser_mem_help_read_N(Addr a, SizeT size) REGPARM(2);
static void eraser_mem_help_write_1(Addr a, UInt val) REGPARM(2);
static void eraser_mem_help_write_2(Addr a, UInt val) REGPARM(2);
static void eraser_mem_help_write_4(Addr a, UInt val) REGPARM(2);
-static void eraser_mem_help_write_N(Addr a, UInt size) REGPARM(2);
+static void eraser_mem_help_write_N(Addr a, SizeT size) REGPARM(2);
static void bus_lock(void);
static void bus_unlock(void);
static
void eraser_pre_mem_read(CorePart part, ThreadId tid,
- Char* s, Addr base, UInt size )
+ Char* s, Addr base, SizeT size )
{
if (tid > 50) { VG_(printf)("pid = %d, s = `%s`, part = %d\n", tid, s, part); VG_(skin_panic)("a");}
eraser_mem_read(base, size, tid);
static
void eraser_pre_mem_write(CorePart part, ThreadId tid,
- Char* s, Addr base, UInt size )
+ Char* s, Addr base, SizeT size )
{
eraser_mem_write(base, size, tid);
}
static
-void eraser_new_mem_startup( Addr a, UInt len, Bool rr, Bool ww, Bool xx )
+void eraser_new_mem_startup( Addr a, SizeT len, Bool rr, Bool ww, Bool xx )
{
/* Ignore the permissions, just make it readable. Seems to work... */
make_segment_readable(a, len);
static
-void eraser_new_mem_heap ( Addr a, UInt len, Bool is_inited )
+void eraser_new_mem_heap ( Addr a, SizeT len, Bool is_inited )
{
if (is_inited) {
make_readable(a, len);
}
static
-void eraser_set_perms (Addr a, UInt len,
+void eraser_set_perms (Addr a, SizeT len,
Bool rr, Bool ww, Bool xx)
{
if (rr) make_readable(a, len);
}
static
-void eraser_new_mem_stack_private(Addr a, UInt len)
+void eraser_new_mem_stack_private(Addr a, SizeT len)
{
set_address_range_state(a, len, Vge_NonVirginInit);
}
static
-void eraser_new_mem_stack(Addr a, UInt len)
+void eraser_new_mem_stack(Addr a, SizeT len)
{
set_address_range_state(a, len, Vge_VirginInit);
}
}
}
-static void eraser_mem_read(Addr a, UInt size, ThreadId tid)
+static void eraser_mem_read(Addr a, SizeT size, ThreadId tid)
{
Addr end;
}
}
-static void eraser_mem_write(Addr a, UInt size, ThreadId tid)
+static void eraser_mem_write(Addr a, SizeT size, ThreadId tid)
{
Addr end;
eraser_mem_read(a, 4, VG_(get_current_tid)());
}
-REGPARM(2) static void eraser_mem_help_read_N(Addr a, UInt size)
+REGPARM(2) static void eraser_mem_help_read_N(Addr a, SizeT size)
{
eraser_mem_read(a, size, VG_(get_current_tid)());
}
if (*(UInt *)a != val)
eraser_mem_write(a, 4, VG_(get_current_tid)());
}
-REGPARM(2) static void eraser_mem_help_write_N(Addr a, UInt size)
+REGPARM(2) static void eraser_mem_help_write_N(Addr a, SizeT size)
{
eraser_mem_write(a, size, VG_(get_current_tid)());
}
void SK_(post_clo_init)(void)
{
- void (*stack_tracker)(Addr a, UInt len);
+ void (*stack_tracker)(Addr a, SizeT len);
if (clo_execontext) {
execontext_map = VG_(malloc)(sizeof(ExeContextMap *) * 65536);
UInt VG_(vg_malloc_redzone_szB) = 16;
/* Function pointers for the two tools to track interesting events. */
-void (*MAC_(new_mem_heap)) ( Addr a, UInt len, Bool is_inited ) = NULL;
-void (*MAC_(ban_mem_heap)) ( Addr a, UInt len ) = NULL;
-void (*MAC_(die_mem_heap)) ( Addr a, UInt len ) = NULL;
-void (*MAC_(copy_mem_heap))( Addr from, Addr to, UInt len ) = NULL;
+void (*MAC_(new_mem_heap)) ( Addr a, SizeT len, Bool is_inited ) = NULL;
+void (*MAC_(ban_mem_heap)) ( Addr a, SizeT len ) = NULL;
+void (*MAC_(die_mem_heap)) ( Addr a, SizeT len ) = NULL;
+void (*MAC_(copy_mem_heap))( Addr from, Addr to, SizeT len ) = NULL;
/* Function pointers for internal sanity checking. */
-Bool (*MAC_(check_noaccess))( Addr a, UInt len, Addr* bad_addr ) = NULL;
+Bool (*MAC_(check_noaccess))( Addr a, SizeT len, Addr* bad_addr ) = NULL;
/*------------------------------------------------------------*/
extern VgHashTable MAC_(mempool_list);
/* Function pointers for the two tools to track interesting events. */
-extern void (*MAC_(new_mem_heap)) ( Addr a, UInt len, Bool is_inited );
-extern void (*MAC_(ban_mem_heap)) ( Addr a, UInt len );
-extern void (*MAC_(die_mem_heap)) ( Addr a, UInt len );
-extern void (*MAC_(copy_mem_heap))( Addr from, Addr to, UInt len );
+extern void (*MAC_(new_mem_heap)) ( Addr a, SizeT len, Bool is_inited );
+extern void (*MAC_(ban_mem_heap)) ( Addr a, SizeT len );
+extern void (*MAC_(die_mem_heap)) ( Addr a, SizeT len );
+extern void (*MAC_(copy_mem_heap))( Addr from, Addr to, SizeT len );
/* Function pointers for internal sanity checking. */
-extern Bool (*MAC_(check_noaccess))( Addr a, UInt len, Addr* bad_addr );
+extern Bool (*MAC_(check_noaccess))( Addr a, SizeT len, Addr* bad_addr );
/* Used in describe_addr() */
extern Bool (*MAC_(describe_addr_supp)) ( Addr a, AddrInfo* ai );
extern REGPARM(1) void MAC_(die_mem_stack_16) ( Addr old_ESP );
extern REGPARM(1) void MAC_(new_mem_stack_32) ( Addr old_ESP );
extern REGPARM(1) void MAC_(die_mem_stack_32) ( Addr old_ESP );
-extern void MAC_(die_mem_stack) ( Addr a, UInt len);
-extern void MAC_(new_mem_stack) ( Addr a, UInt len);
+extern void MAC_(die_mem_stack) ( Addr a, SizeT len);
+extern void MAC_(new_mem_stack) ( Addr a, SizeT len);
/*------------------------------------------------------------*/
} \
} \
\
-void MAC_(new_mem_stack) ( Addr a, UInt len ) \
+void MAC_(new_mem_stack) ( Addr a, SizeT len ) \
{ \
PROF_EVENT(115); \
UNALIGNED_NEW ( a, len ); \
} \
\
-void MAC_(die_mem_stack) ( Addr a, UInt len ) \
+void MAC_(die_mem_stack) ( Addr a, SizeT len ) \
{ \
PROF_EVENT(125); \
UNALIGNED_DIE ( a, len ); \
extern REGPARM(1) UInt MC_(helperc_LOADV2) ( Addr );
extern REGPARM(1) UInt MC_(helperc_LOADV4) ( Addr );
-extern REGPARM(2) void MC_(fpu_write_check) ( Addr addr, Int size );
-extern REGPARM(2) void MC_(fpu_read_check) ( Addr addr, Int size );
+extern REGPARM(2) void MC_(fpu_write_check) ( Addr addr, SizeT size );
+extern REGPARM(2) void MC_(fpu_read_check) ( Addr addr, SizeT size );
/* For client requests */
-extern void MC_(make_noaccess) ( Addr a, UInt len );
-extern void MC_(make_readable) ( Addr a, UInt len );
-extern void MC_(make_writable) ( Addr a, UInt len );
+extern void MC_(make_noaccess) ( Addr a, SizeT len );
+extern void MC_(make_readable) ( Addr a, SizeT len );
+extern void MC_(make_writable) ( Addr a, SizeT len );
-extern Bool MC_(check_writable) ( Addr a, UInt len, Addr* bad_addr );
-extern Bool MC_(check_readable) ( Addr a, UInt len, Addr* bad_addr );
+extern Bool MC_(check_writable) ( Addr a, SizeT len, Addr* bad_addr );
+extern Bool MC_(check_readable) ( Addr a, SizeT len, Addr* bad_addr );
extern void MC_(detect_memory_leaks) ( void );
ThreadId tid,
Addr dataV,
Addr vbitsV,
- UInt size,
+ SizeT size,
Bool setting /* True <=> set vbits, False <=> get vbits */
);
static void mc_wr_V4_SLOWLY ( Addr a, UInt vbytes );
static void mc_wr_V2_SLOWLY ( Addr a, UInt vbytes );
static void mc_wr_V1_SLOWLY ( Addr a, UInt vbytes );
-static void mc_fpu_read_check_SLOWLY ( Addr addr, Int size );
-static void mc_fpu_write_check_SLOWLY ( Addr addr, Int size );
+static void mc_fpu_read_check_SLOWLY ( Addr addr, SizeT size );
+static void mc_fpu_write_check_SLOWLY ( Addr addr, SizeT size );
/*------------------------------------------------------------*/
/*--- Data defns. ---*/
/*--- Setting permissions over address ranges. ---*/
/*------------------------------------------------------------*/
-static void set_address_range_perms ( Addr a, UInt len,
+static void set_address_range_perms ( Addr a, SizeT len,
UInt example_a_bit,
UInt example_v_bit )
{
/* Set permissions for address ranges ... */
-void MC_(make_noaccess) ( Addr a, UInt len )
+void MC_(make_noaccess) ( Addr a, SizeT len )
{
PROF_EVENT(35);
- DEBUG("MC_(make_noaccess)(%p, %x)\n", a, len);
+ DEBUG("MC_(make_noaccess)(%p, %llu)\n", a, (ULong)len);
set_address_range_perms ( a, len, VGM_BIT_INVALID, VGM_BIT_INVALID );
}
-void MC_(make_writable) ( Addr a, UInt len )
+void MC_(make_writable) ( Addr a, SizeT len )
{
PROF_EVENT(36);
- DEBUG("MC_(make_writable)(%p, %x)\n", a, len);
+ DEBUG("MC_(make_writable)(%p, %llu)\n", a, (ULong)len);
set_address_range_perms ( a, len, VGM_BIT_VALID, VGM_BIT_INVALID );
}
-void MC_(make_readable) ( Addr a, UInt len )
+void MC_(make_readable) ( Addr a, SizeT len )
{
PROF_EVENT(37);
- DEBUG("MC_(make_readable)(%p, 0x%x)\n", a, len);
+ DEBUG("MC_(make_readable)(%p, %llu)\n", a, (ULong)len);
set_address_range_perms ( a, len, VGM_BIT_VALID, VGM_BIT_VALID );
}
);
/* Block-copy permissions (needed for implementing realloc()). */
-static void mc_copy_address_range_state ( Addr src, Addr dst, UInt len )
+static void mc_copy_address_range_state ( Addr src, Addr dst, SizeT len )
{
- UInt i;
+ SizeT i;
DEBUG("mc_copy_address_range_state\n");
returns False, and if bad_addr is non-NULL, sets *bad_addr to
indicate the lowest failing address. Functions below are
similar. */
-Bool MC_(check_noaccess) ( Addr a, UInt len, Addr* bad_addr )
+Bool MC_(check_noaccess) ( Addr a, SizeT len, Addr* bad_addr )
{
- UInt i;
+ SizeT i;
UChar abit;
PROF_EVENT(42);
for (i = 0; i < len; i++) {
return True;
}
-Bool MC_(check_writable) ( Addr a, UInt len, Addr* bad_addr )
+Bool MC_(check_writable) ( Addr a, SizeT len, Addr* bad_addr )
{
- UInt i;
+ SizeT i;
UChar abit;
PROF_EVENT(42);
for (i = 0; i < len; i++) {
return True;
}
-Bool MC_(check_readable) ( Addr a, UInt len, Addr* bad_addr )
+Bool MC_(check_readable) ( Addr a, SizeT len, Addr* bad_addr )
{
- UInt i;
+ SizeT i;
UChar abit;
UChar vbyte;
static
void mc_check_is_writable ( CorePart part, ThreadId tid, Char* s,
- Addr base, UInt size )
+ Addr base, SizeT size )
{
Bool ok;
Addr bad_addr;
static
void mc_check_is_readable ( CorePart part, ThreadId tid, Char* s,
- Addr base, UInt size )
+ Addr base, SizeT size )
{
Bool ok;
Addr bad_addr;
static
-void mc_new_mem_startup( Addr a, UInt len, Bool rr, Bool ww, Bool xx )
+void mc_new_mem_startup( Addr a, SizeT len, Bool rr, Bool ww, Bool xx )
{
/* Ignore the permissions, just make it readable. Seems to work... */
- DEBUG("mc_new_mem_startup(%p, %u, rr=%u, ww=%u, xx=%u)\n", a,len,rr,ww,xx);
+ DEBUG("mc_new_mem_startup(%p, %llu, rr=%u, ww=%u, xx=%u)\n",
+ a,(ULong)len,rr,ww,xx);
MC_(make_readable)(a, len);
}
static
-void mc_new_mem_heap ( Addr a, UInt len, Bool is_inited )
+void mc_new_mem_heap ( Addr a, SizeT len, Bool is_inited )
{
if (is_inited) {
MC_(make_readable)(a, len);
}
static
-void mc_set_perms (Addr a, UInt len, Bool rr, Bool ww, Bool xx)
+void mc_set_perms (Addr a, SizeT len, Bool rr, Bool ww, Bool xx)
{
- DEBUG("mc_set_perms(%p, %u, rr=%u ww=%u, xx=%u)\n", a, len, rr, ww, xx);
+ DEBUG("mc_set_perms(%p, %llu, rr=%u ww=%u, xx=%u)\n",
+ a, (ULong)len, rr, ww, xx);
if (rr) MC_(make_readable)(a, len);
else if (ww) MC_(make_writable)(a, len);
else MC_(make_noaccess)(a, len);
------------------------------------------------------------------ */
REGPARM(2)
-void MC_(fpu_read_check) ( Addr addr, Int size )
+void MC_(fpu_read_check) ( Addr addr, SizeT size )
{
/* Ensure the read area is both addressible and valid (ie,
readable). If there's an address error, don't report a value
REGPARM(2)
-void MC_(fpu_write_check) ( Addr addr, Int size )
+void MC_(fpu_write_check) ( Addr addr, SizeT size )
{
/* Ensure the written area is addressible, and moan if otherwise.
If it is addressible, make it valid, otherwise invalid.
there's an addr error, don't report a value error even if it
exists. */
-void mc_fpu_read_check_SLOWLY ( Addr addr, Int size )
+void mc_fpu_read_check_SLOWLY ( Addr addr, SizeT size )
{
Int i;
Bool aerr = False;
/* Generic version. Test for addr errors. Valid addresses are
given valid values, and invalid addresses invalid values. */
-void mc_fpu_write_check_SLOWLY ( Addr addr, Int size )
+void mc_fpu_write_check_SLOWLY ( Addr addr, SizeT size )
{
Int i;
Addr a_here;
ThreadId tid,
Addr dataV,
Addr vbitsV,
- UInt size,
+ SizeT size,
Bool setting /* True <=> set vbits, False <=> get vbits */
)
{
Bool addressibleV = True;
UInt* data = (UInt*)dataV;
UInt* vbits = (UInt*)vbitsV;
- UInt szW = size / 4; /* sigh */
- UInt i;
+ SizeT szW = size / 4; /* sigh */
+ SizeT i;
UInt* dataP = NULL; /* bogus init to keep gcc happy */
UInt* vbitsP = NULL; /* ditto */