X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=snapshotimp.h;h=fbff35f42470e8d2604f0236690af2773c6c29dc;hp=4991845ce37921c4cf1aa1f7d9045b08ca2994a1;hb=6e5c0bb2359b9fba6160957ffa88974233ba18ac;hpb=7320a16b1a16bf1f803bc43856b24a94c0fb4c8e diff --git a/snapshotimp.h b/snapshotimp.h index 4991845c..fbff35f4 100644 --- a/snapshotimp.h +++ b/snapshotimp.h @@ -1,71 +1,71 @@ -#ifndef _SNAPSHOTIMP_H -#define _SNAPSHOTIMP_H +/** @file snapshotimp.h + * @brief Snapshotting implementation header file.. + */ + +#ifndef __SNAPSHOTIMP_H__ +#define __SNAPSHOTIMP_H__ + +#include + #include "snapshot.h" -#include -#include -#include -#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. - -#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 //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 - - 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 }; -//Global reference to snapshot data structure -extern struct SnapShot * snapshotrecord; -void * ReturnPageAlignedAddress( void *); -void * PageAlignAddressUpward( void *); #else -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 + +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 #endif + +//Global reference to snapshot data structure +extern struct SnapShot *snapshotrecord; + +#endif /* __SNAPSHOTIMP_H__ */