I will begin to utilize the 'model_snapshot_space' as the
model-checker's private snapshotting heap.
+/** @brief Global mspace reference for the model-checker's snapshotting heap */
+mspace model_snapshot_space = NULL;
+
#if USE_MPROTECT_SNAPSHOT
/** @brief Global mspace reference for the user's snapshotting heap
#if USE_MPROTECT_SNAPSHOT
/** @brief Global mspace reference for the user's snapshotting heap
extern mspace user_snapshot_space;
#endif
extern mspace user_snapshot_space;
#endif
+extern mspace model_snapshot_space;
+
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
/* extern declaration definition */
struct SnapShot * snapshotrecord = NULL;
/* 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
#if !USE_MPROTECT_SNAPSHOT
/** @statics
* These variables are necessary because the stack is shared region and
#else /* USE_MPROTECT_SNAPSHOT */
#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.
*/
/** 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 * 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);
+
if (!snapshotrecord)
createSharedMemory();
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 );
//step 2 setup the stack context.
ucontext_t newContext;
getcontext( &newContext );