fix page alignment issue...
[c11tester.git] / snapshot.cc
index f5cefe685f2b2eef8c738ecb895c3b2624c8c018..83d22b4f5939b31ec7689177aed381b057966697 100644 (file)
@@ -137,8 +137,11 @@ void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots
                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.