/* extern declaration definition */
struct SnapShot * snapshotrecord = NULL;
+/** PageAlignedAdressUpdate return a page aligned address for the
+ * address being added as a side effect the numBytes are also changed.
+ */
+static void * PageAlignAddressUpward(void * addr) {
+ return (void *)((((uintptr_t)addr)+PAGESIZE-1)&~(PAGESIZE-1));
+}
+
#if !USE_MPROTECT_SNAPSHOT
/** @statics
* These variables are necessary because the stack is shared region and
#else /* USE_MPROTECT_SNAPSHOT */
-/** PageAlignedAdressUpdate return a page aligned address for the
- * address being added as a side effect the numBytes are also changed.
- */
-static void * PageAlignAddressUpward(void * addr) {
- return (void *)((((uintptr_t)addr)+PAGESIZE-1)&~(PAGESIZE-1));
-}
-
/** ReturnPageAlignedAddress returns a page aligned address for the
* address being added as a side effect the numBytes are also changed.
*/
void * pagealignedbase=PageAlignAddressUpward(basemySpace);
user_snapshot_space = create_mspace_with_base(pagealignedbase, numheappages * PAGESIZE, 1);
addMemoryRegionToSnapShot(pagealignedbase, numheappages);
+
+ void *base_model_snapshot_space = model_malloc((numheappages + 1) * PAGESIZE);
+ pagealignedbase = PageAlignAddressUpward(base_model_snapshot_space);
+ model_snapshot_space = create_mspace_with_base(pagealignedbase, numheappages * PAGESIZE, 1);
+ addMemoryRegionToSnapShot(pagealignedbase, numheappages);
+
entryPoint();
}
#else
if (!snapshotrecord)
createSharedMemory();
+ void *base_model_snapshot_space = malloc((numheappages + 1) * PAGESIZE);
+ void *pagealignedbase = PageAlignAddressUpward(base_model_snapshot_space);
+ model_snapshot_space = create_mspace_with_base(pagealignedbase, numheappages * PAGESIZE, 1);
+
//step 2 setup the stack context.
ucontext_t newContext;
getcontext( &newContext );