#endif
}
mspace mySpace = NULL;
+void * basemySpace = NULL;
+
void *malloc( size_t size ) {
return mspace_malloc( mySpace, size );
}
extern mspace create_mspace_with_base(void* base, size_t capacity, int locked);
extern mspace create_mspace(size_t capacity, int locked);
extern mspace mySpace;
+extern void * basemySpace;
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
exit(-1);
}
initSnapShotRecord(numbackingpages, numsnapshots, nummemoryregions);
- mySpace = create_mspace( numheappages*PAGESIZE, 1 );
- addMemoryRegionToSnapShot(mySpace, numheappages);
+
+ basemySpace=MYMALLOC((numheappages+1)*PAGESIZE);
+ void * pagealignedbase=(void *)((((uintptr_t)basemySpace)+PAGESIZE-1)&~(PAGESIZE-1));
+ mySpace = create_mspace_with_base(pagealignedbase, numheappages*PAGESIZE, 1 );
+ addMemoryRegionToSnapShot(pagealignedbase, numheappages);
entryPoint();
#else
//add a signal to indicate that the process is going to terminate.