1 /** @file snapshotimp.h
2 * @brief Snapshotting implementation header file..
5 #ifndef __SNAPSHOTIMP_H__
6 #define __SNAPSHOTIMP_H__
12 #define SHARED_MEMORY_DEFAULT (100 * ((size_t)1 << 20)) // 100mb for the shared memory
13 #define STACK_SIZE_DEFAULT (((size_t)1 << 20) * 20) // 20 mb out of the above 100 mb for my stack
15 #if USE_MPROTECT_SNAPSHOT
16 //Each snapshotrecord lists the firstbackingpage that must be written to revert to that snapshot
17 struct SnapShotRecord {
18 unsigned int firstBackingPage;
21 //Backing store page struct
26 //List the base address of the corresponding page in the backing store so we know where to copy it to
27 struct BackingPageRecord {
31 //Stuct for each memory region
33 void * basePtr; //base of memory region
34 int sizeInPages; //size of memory region in pages
37 //Primary struct for snapshotting system....
39 struct MemoryRegion * regionsToSnapShot; //This pointer references an array of memory regions to snapshot
40 struct SnapShotPage * backingStore; //This pointer references an array of snapshotpage's that form the backing store
41 void * backingStoreBasePtr; //This pointer references an array of snapshotpage's that form the backing store
42 struct BackingPageRecord * backingRecords; //This pointer references an array of backingpagerecord's (same number of elements as backingstore
43 struct SnapShotRecord * snapShots; //This pointer references the snapshot array
45 unsigned int lastSnapShot; //Stores the next snapshot record we should use
46 unsigned int lastBackingPage; //Stores the next backingpage we should use
47 unsigned int lastRegion; //Stores the next memory region to be used
49 unsigned int maxRegions; //Stores the max number of memory regions we support
50 unsigned int maxBackingPages; //Stores the total number of backing pages
51 unsigned int maxSnapShots; //Stores the total number of snapshots we allow
59 void *mSharedMemoryBase;
62 volatile snapshot_id mIDToRollback;
63 ucontext_t mContextToRollback;
64 snapshot_id currSnapShotID;
68 //Global reference to snapshot data structure
69 extern struct SnapShot * snapshotrecord;
71 #endif /* __SNAPSHOTIMP_H__ */