test whole program
This commit is contained in:
@@ -256,42 +256,42 @@ static void INITREGULARALLOC(void) {
|
||||
|
||||
int notrun = 0;
|
||||
// Quick malloc implementation with mmap
|
||||
void *malloc(size_t sz)
|
||||
{
|
||||
// If malloc is called for the first time then allocate huge page
|
||||
// if (notrun == 0) {
|
||||
// INITREGULARALLOC();
|
||||
// notrun = 1;
|
||||
// }
|
||||
sz = __builtin_align_up(sz, _Alignof(max_align_t));
|
||||
// void *malloc(size_t sz)
|
||||
// {
|
||||
// // If malloc is called for the first time then allocate huge page
|
||||
// // if (notrun == 0) {
|
||||
// // INITREGULARALLOC();
|
||||
// // notrun = 1;
|
||||
// // }
|
||||
// sz = __builtin_align_up(sz, _Alignof(max_align_t));
|
||||
|
||||
// printf("%d \n", sz);
|
||||
printf("%d Malloc counter\n", MallocCounter);
|
||||
// // printf("%d \n", sz);
|
||||
// // printf("%d Malloc counter\n", MallocCounter);
|
||||
|
||||
MallocCounter -= sz;
|
||||
void *ptrLink = &ptr[MallocCounter];
|
||||
ptrLink = cheri_setbounds(ptrLink, sz);
|
||||
// MallocCounter -= sz;
|
||||
// void *ptrLink = &ptr[MallocCounter];
|
||||
// ptrLink = cheri_setbounds(ptrLink, sz);
|
||||
|
||||
return ptrLink;
|
||||
// return ptrLink;
|
||||
|
||||
// if (heap + sz > heap_start + HEAP_SIZE) return NULL;
|
||||
// heap += sz;
|
||||
// return heap - sz;
|
||||
// // if (heap + sz > heap_start + HEAP_SIZE) return NULL;
|
||||
// // heap += sz;
|
||||
// // return heap - sz;
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
// Quick cheri free implementation
|
||||
void free(void *ptr) {
|
||||
// // Quick cheri free implementation
|
||||
// void free(void *ptr) {
|
||||
|
||||
// printf("free called \n");
|
||||
// // printf("free called \n");
|
||||
|
||||
// get bounds from
|
||||
int len = cheri_getlen(ptr);
|
||||
// // get bounds from
|
||||
// int len = cheri_getlen(ptr);
|
||||
|
||||
// printf("free len %d \n", len);
|
||||
// // printf("free len %d \n", len);
|
||||
|
||||
munmap(ptr, len);
|
||||
}
|
||||
// munmap(ptr, len);
|
||||
// }
|
||||
// Standard Alloc
|
||||
// void* MALLOCREGULAR(size_t sz) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user