fix page alignment issue...
authorBrian Demsky <bdemsky@uci.edu>
Thu, 24 May 2012 18:40:14 +0000 (11:40 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Thu, 24 May 2012 18:40:14 +0000 (11:40 -0700)
mymemory.cc
mymemory.h
snapshot.cc

index 9d598af7dfec11d77add4ecf02dbc845df924e00..a825bb940f66f4331e723eadd8983f9bd8d05e70 100644 (file)
@@ -52,6 +52,8 @@ void MYFREE(void *ptr) {
 #endif
 }
 mspace mySpace = NULL;
 #endif
 }
 mspace mySpace = NULL;
+void * basemySpace = NULL;
+
 void *malloc( size_t size ) {
        return mspace_malloc( mySpace, size );
 }
 void *malloc( size_t size ) {
        return mspace_malloc( mySpace, size );
 }
index afaffa458300293a9b5691220ace2dc4533ef97f..90b27844f5f8e025c68ef8be56d50f93cbdf2a72 100644 (file)
@@ -122,6 +122,7 @@ extern void mspace_free(mspace msp, void* mem);
 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 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
 #ifdef __cplusplus
 };  /* end of extern "C" */
 #endif
index f5cefe685f2b2eef8c738ecb895c3b2624c8c018..83d22b4f5939b31ec7689177aed381b057966697 100644 (file)
@@ -137,8 +137,11 @@ void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots
                exit(-1);
        }
        initSnapShotRecord(numbackingpages, numsnapshots, nummemoryregions);
                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.
        entryPoint();
 #else
        //add a signal to indicate that the process is going to terminate.