mymemory/snapshot: rearrange snapshot implementation
[model-checker.git] / snapshotimp.h
index fbff35f42470e8d2604f0236690af2773c6c29dc..6efdbd9a4ac3799fbd628ec4e2a1eb5c1cc12f59 100644 (file)
@@ -9,19 +9,14 @@
 
 #include "snapshot.h"
 
-#define SHARED_MEMORY_DEFAULT  (100 * ((size_t)1 << 20)) // 100mb for the shared memory
-#define STACK_SIZE_DEFAULT      (((size_t)1 << 20) * 20)  // 20 mb out of the above 100 mb for my stack
-
 #if USE_MPROTECT_SNAPSHOT
 //Each snapshotrecord lists the firstbackingpage that must be written to revert to that snapshot
 struct SnapShotRecord {
        unsigned int firstBackingPage;
 };
 
-//Backing store page struct
-struct SnapShotPage {
-       char data[PAGESIZE];
-};
+/** @brief Backing store page */
+typedef unsigned char snapshot_page_t[PAGESIZE];
 
 //List the base address of the corresponding page in the backing store so we know where to copy it to
 struct BackingPageRecord {
@@ -37,7 +32,7 @@ struct MemoryRegion {
 //Primary struct for snapshotting system....
 struct SnapShot {
        struct MemoryRegion *regionsToSnapShot; //This pointer references an array of memory regions to snapshot
-       struct SnapShotPage *backingStore; //This pointer references an array of snapshotpage's that form the backing store
+       snapshot_page_t *backingStore; //This pointer references an array of snapshotpage's that form the backing store
        void *backingStoreBasePtr; //This pointer references an array of snapshotpage's that form the backing store
        struct BackingPageRecord *backingRecords; //This pointer references an array of backingpagerecord's (same number of elements as backingstore
        struct SnapShotRecord *snapShots; //This pointer references the snapshot array
@@ -55,6 +50,9 @@ struct SnapShot {
 
 #include <ucontext.h>
 
+#define SHARED_MEMORY_DEFAULT  (100 * ((size_t)1 << 20)) // 100mb for the shared memory
+#define STACK_SIZE_DEFAULT      (((size_t)1 << 20) * 20)  // 20 mb out of the above 100 mb for my stack
+
 struct SnapShot {
        void *mSharedMemoryBase;
        void *mStackBase;