snapshot: use snapshot_space only in mprotect-based
[model-checker.git] / snapshot.cc
index 747f7c2502529306dfc07fd32a09b72c4f5ad2e9..0c90da839912c59ff1b5db675efec367796328bc 100644 (file)
@@ -45,7 +45,8 @@ struct SnapShot * snapshotrecord = NULL;
 static ucontext_t savedSnapshotContext;
 static ucontext_t savedUserSnapshotContext;
 static snapshot_id snapshotid = 0;
-#endif
+
+#else /* USE_MPROTECT_SNAPSHOT */
 
 /** PageAlignedAdressUpdate return a page aligned address for the
  * address being added as a side effect the numBytes are also changed.
@@ -54,8 +55,6 @@ static void * PageAlignAddressUpward(void * addr) {
        return (void *)((((uintptr_t)addr)+PAGESIZE-1)&~(PAGESIZE-1));
 }
 
-#if USE_MPROTECT_SNAPSHOT
-
 /** ReturnPageAlignedAddress returns a page aligned address for the
  * address being added as a side effect the numBytes are also changed.
  */
@@ -109,7 +108,7 @@ static void HandlePF( int sig, siginfo_t *si, void * unused){
                // Handle error by quitting?
        }
 }
-#endif //nothing to handle for non snapshotting case.
+#endif /* USE_MPROTECT_SNAPSHOT */
 
 #if !USE_MPROTECT_SNAPSHOT
 void createSharedMemory(){
@@ -181,9 +180,6 @@ void initSnapshotLibrary(unsigned int numbackingpages,
 void initSnapshotLibrary(unsigned int numbackingpages,
                unsigned int numsnapshots, unsigned int nummemoryregions,
                unsigned int numheappages, VoidFuncPtr entryPoint) {
-       void *basemySpace = system_malloc((numheappages+1)*PAGESIZE);
-       void * pagealignedbase=PageAlignAddressUpward(basemySpace);
-       snapshot_space = create_mspace_with_base(pagealignedbase, numheappages * PAGESIZE, 1);
        if (!snapshotrecord)
                createSharedMemory();