X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=blobdiff_plain;f=snapshotimp.h;h=2e4929d0477e4605cd5363fb86266cd054d1f3fe;hp=c28b4ebf015ff0b89acf46700288d353263a66f9;hb=fe7b400edb33255770fb47ad520afbd05d13a231;hpb=1d6c949fef3b5da936f8499dde464f8df634267a diff --git a/snapshotimp.h b/snapshotimp.h index c28b4eb..2e4929d 100644 --- a/snapshotimp.h +++ b/snapshotimp.h @@ -1,3 +1,7 @@ +/** @file snapshotimp.h + * @brief Snapshotting implementation header file.. + */ + #ifndef _SNAPSHOTIMP_H #define _SNAPSHOTIMP_H #include "snapshot.h" @@ -7,64 +11,59 @@ #include #include #include -#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. +#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_CHECKPOINTING +#if USE_MPROTECT_SNAPSHOT //Each snapshotrecord lists the firstbackingpage that must be written to revert to that snapshot struct SnapShotRecord { - unsigned int firstBackingPage; + unsigned int firstBackingPage; }; //Backing store page struct struct SnapShotPage { - char data[PAGESIZE]; + char data[PAGESIZE]; }; //List the base address of the corresponding page in the backing store so we know where to copy it to struct BackingPageRecord { - void * basePtrOfPage; + void * basePtrOfPage; }; //Stuct for each memory region struct MemoryRegion { - void * basePtr; //base of memory region - int sizeInPages; //size of memory region in pages + void * basePtr; //base of memory region + int sizeInPages; //size of memory region in pages }; //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 - 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 + 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 + 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 }; -//Global reference to snapshot data structure -extern struct SnapShot * snapshotrecord; -void * ReturnPageAlignedAddress( void *); #else -struct Snapshot_t{ -char *mSharedMemoryBase; -char *mStackBase; -size_t mStackSize; -snapshot_id mIDToRollback; -ucontext_t mContextToRollback; -snapshot_id currSnapShotID; -#if DEBUG -struct timeval startTimeGlobal; -#endif -volatile bool mbFinalize; +struct SnapShot { + void *mSharedMemoryBase; + void *mStackBase; + size_t mStackSize; + volatile snapshot_id mIDToRollback; + ucontext_t mContextToRollback; + snapshot_id currSnapShotID; }; -extern struct Snapshot_t * sTheRecord; #endif + +//Global reference to snapshot data structure +extern struct SnapShot * snapshotrecord; #endif