Addr p, SizeT size, SizeT align, UInt rzB,
Bool is_zeroed, MAC_AllocKind kind, VgHashTable table)
{
- VGP_PUSHCC(VgpCliMalloc);
cmalloc_n_mallocs ++;
// Allocate and zero if necessary
tl_assert(MAC_AllocCustom != kind);
p = (Addr)VG_(cli_malloc)( align, size );
if (!p) {
- VGP_POPCC(VgpCliMalloc);
return NULL;
}
if (is_zeroed) VG_(memset)((void*)p, 0, size);
MAC_(new_mem_heap)( p, size, is_zeroed );
MAC_(ban_mem_heap)( p+size, rzB );
- VGP_POPCC(VgpCliMalloc);
-
return (void*)p;
}
{
MAC_Chunk* mc;
- VGP_PUSHCC(VgpCliMalloc);
-
cmalloc_n_frees++;
mc = VG_(HT_remove) ( MAC_(malloc_list), (UWord)p );
}
die_and_free_mem ( tid, mc, rzB );
}
-
- VGP_POPCC(VgpCliMalloc);
}
void MAC_(free) ( ThreadId tid, void* p )
void* p_new;
SizeT old_size;
- VGP_PUSHCC(VgpCliMalloc);
-
cmalloc_n_frees ++;
cmalloc_n_mallocs ++;
cmalloc_bs_mallocd += new_size;
if (mc == NULL) {
MAC_(record_free_error) ( tid, (Addr)p_old );
/* We return to the program regardless. */
- VGP_POPCC(VgpCliMalloc);
return NULL;
}
// than growing it, and this way simplifies the growing case.
VG_(HT_add_node)( MAC_(malloc_list), mc );
- VGP_POPCC(VgpCliMalloc);
return p_new;
}
Bool ok;
Addr bad_addr;
- VGP_PUSHCC(VgpCheckMem);
-
/* VG_(message)(Vg_DebugMsg,"check is writable: %x .. %x",
base,base+size-1); */
ok = mc_check_writable ( base, size, &bad_addr );
VG_(tool_panic)("mc_check_is_writable: unexpected CorePart");
}
}
-
- VGP_POPCC(VgpCheckMem);
}
static
Addr bad_addr;
MC_ReadResult res;
- VGP_PUSHCC(VgpCheckMem);
-
res = mc_check_readable ( base, size, &bad_addr );
if (0)
VG_(tool_panic)("mc_check_is_readable: unexpected CorePart");
}
}
- VGP_POPCC(VgpCheckMem);
}
static
Addr bad_addr = 0; // shut GCC up
/* VG_(message)(Vg_DebugMsg,"check is readable asciiz: 0x%x",str); */
- VGP_PUSHCC(VgpCheckMem);
-
tl_assert(part == Vg_CoreSysCall);
res = mc_check_readable_asciiz ( (Addr)str, &bad_addr );
if (MC_Ok != res) {
Bool isUnaddr = ( MC_AddrErr == res ? True : False );
MAC_(record_param_error) ( tid, bad_addr, /*isReg*/False, isUnaddr, s );
}
-
- VGP_POPCC(VgpCheckMem);
}
static