* snapshotid. it is incremented and set in a persistently shared record
*/
static ucontext_t private_ctxt;
-static ucontext_t exit_ctxt;
static snapshot_id snapshotid = 0;
/**
fork_snap->mStackSize = STACK_SIZE_DEFAULT;
fork_snap->mIDToRollback = -1;
fork_snap->currSnapShotID = 0;
+ sStaticSpace = create_shared_mspace();
}
/**
return create_mspace_with_base((void *)(fork_snap->mSharedMemoryBase), SHARED_MEMORY_DEFAULT - sizeof(*fork_snap), 1);
}
-static void fork_snapshot_init(unsigned int numbackingpages,
- unsigned int numsnapshots, unsigned int nummemoryregions,
- unsigned int numheappages)
+static void fork_snapshot_init(unsigned int numheappages)
{
if (!fork_snap)
createSharedMemory();
}
}
-static void fork_startExecution(ucontext_t *context, VoidFuncPtr entryPoint) {
- /* setup an "exiting" context */
- int exit_stack_size = 256;
- create_context(&exit_ctxt, snapshot_calloc(exit_stack_size, 1), exit_stack_size, fork_exit);
-
- /* setup the system context */
- create_context(context, fork_snap->mStackBase, STACK_SIZE_DEFAULT, entryPoint);
+static void fork_startExecution() {
/* switch to a new entryPoint context, on a new stack */
create_context(&private_ctxt, snapshot_calloc(STACK_SIZE_DEFAULT, 1), STACK_SIZE_DEFAULT, fork_loop);
}
static snapshot_id fork_take_snapshot() {
model_swapcontext(&shared_ctxt, &private_ctxt);
DEBUG("TAKESNAPSHOT RETURN\n");
+ fork_snap->mIDToRollback = -1;
return snapshotid;
}
{
DEBUG("Rollback\n");
fork_snap->mIDToRollback = theID;
- model_swapcontext(model->get_system_context(), &exit_ctxt);
- fork_snap->mIDToRollback = -1;
+ fork_exit();
}
/**
* @brief Initializes the snapshot system
* @param entryPoint the function that should run the program.
*/
-void snapshot_system_init(unsigned int numbackingpages,
- unsigned int numsnapshots, unsigned int nummemoryregions,
- unsigned int numheappages)
+void snapshot_system_init(unsigned int numheappages)
{
- fork_snapshot_init(numbackingpages, numsnapshots, nummemoryregions, numheappages);
+ fork_snapshot_init(numheappages);
}
-void startExecution(ucontext_t *context, VoidFuncPtr entryPoint)
-{
- fork_startExecution(context, entryPoint);
+void startExecution() {
+ fork_startExecution();
}
/** Takes a snapshot of memory.