|
|
@ -31,7 +31,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Restore a full mcontext
|
|
|
|
* Restore a full mcontext
|
|
|
|
* Writes sandbox_context to active_context and then zeroes sandbox_context out
|
|
|
|
* Writes sandbox_context to active_context
|
|
|
|
* @param active_context - the context of the current worker thread
|
|
|
|
* @param active_context - the context of the current worker thread
|
|
|
|
* @param sandbox_context - the context that we want to restore
|
|
|
|
* @param sandbox_context - the context that we want to restore
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -75,8 +75,6 @@ arch_context_restore(mcontext_t *active_context, struct arch_context *sandbox_co
|
|
|
|
|
|
|
|
|
|
|
|
active_context->gregs[REG_RSP] = sandbox_context->regs[ureg_rsp];
|
|
|
|
active_context->gregs[REG_RSP] = sandbox_context->regs[ureg_rsp];
|
|
|
|
active_context->gregs[REG_RIP] = sandbox_context->regs[ureg_rip] + ARCH_SIG_JMP_OFF;
|
|
|
|
active_context->gregs[REG_RIP] = sandbox_context->regs[ureg_rip] + ARCH_SIG_JMP_OFF;
|
|
|
|
sandbox_context->regs[ureg_rsp] = 0;
|
|
|
|
|
|
|
|
sandbox_context->regs[ureg_rip] = 0;
|
|
|
|
|
|
|
|
sandbox_context->variant = arch_context_running;
|
|
|
|
sandbox_context->variant = arch_context_running;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -102,8 +100,6 @@ arch_mcontext_save(struct arch_context *sandbox_context, const mcontext_t *activ
|
|
|
|
assert(active_context->gregs[REG_RSP] != 0);
|
|
|
|
assert(active_context->gregs[REG_RSP] != 0);
|
|
|
|
|
|
|
|
|
|
|
|
sandbox_context->variant = arch_context_slow;
|
|
|
|
sandbox_context->variant = arch_context_slow;
|
|
|
|
sandbox_context->regs[ureg_rsp] = 0;
|
|
|
|
|
|
|
|
sandbox_context->regs[ureg_rip] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Copy mcontext */
|
|
|
|
/* Copy mcontext */
|
|
|
|
memcpy(&sandbox_context->mctx, active_context, sizeof(mcontext_t));
|
|
|
|
memcpy(&sandbox_context->mctx, active_context, sizeof(mcontext_t));
|
|
|
|