-#include <iostream>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <csignal>
-#define SHARED_MEMORY_DEFAULT ( 100 * ( 1 << 20 ) ) // 100mb for the shared memory
-#define STACK_SIZE_DEFAULT ( ( 1 << 20 ) * 20 ) //20 mb out of the above 100 mb for my stack.
-
-#if USE_CHECKPOINTING
+
+#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
};
//List the base address of the corresponding page in the backing store so we know where to copy it to
struct BackingPageRecord {
};
//List the base address of the corresponding page in the backing store so we know where to copy it to
struct BackingPageRecord {
- 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
- 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
-
- unsigned int lastSnapShot; //Stores the next snapshot record we should use
- unsigned int lastBackingPage; //Stores the next backingpage we should use
- unsigned int lastRegion; //Stores the next memory region to be used
-
- unsigned int maxRegions; //Stores the max number of memory regions we support
- unsigned int maxBackingPages; //Stores the total number of backing pages
- unsigned int maxSnapShots; //Stores the total number of snapshots we allow
+ 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
+ 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
+
+ unsigned int lastSnapShot; //Stores the next snapshot record we should use
+ unsigned int lastBackingPage; //Stores the next backingpage we should use
+ unsigned int lastRegion; //Stores the next memory region to be used
+
+ unsigned int maxRegions; //Stores the max number of memory regions we support
+ unsigned int maxBackingPages; //Stores the total number of backing pages
+ unsigned int maxSnapShots; //Stores the total number of snapshots we allow
-struct Snapshot_t{
-char *mSharedMemoryBase;
-char *mStackBase;
-size_t mStackSize;
-snapshot_id mIDToRollback;
-ucontext_t mContextToRollback;
-snapshot_id currSnapShotID;
-#if SSDEBUG
-struct timeval startTimeGlobal;
-#endif
-volatile bool mbFinalize;
+
+#include <ucontext.h>
+
+struct SnapShot {
+ void *mSharedMemoryBase;
+ void *mStackBase;
+ size_t mStackSize;
+ volatile snapshot_id mIDToRollback;
+ ucontext_t mContextToRollback;
+ snapshot_id currSnapShotID;