chore: comment context variants and use running

main
Sean McBride 5 years ago
parent bbc8d05ec9
commit 42566b1c6e

@ -30,10 +30,10 @@ typedef enum
/* The enum is compared directly in assembly, so maintain integral values! */ /* The enum is compared directly in assembly, so maintain integral values! */
typedef enum typedef enum
{ {
arch_context_unused = 0, arch_context_unused = 0, /* Has not have saved a context */
arch_context_fast = 1, arch_context_fast = 1, /* Saved a fastpath context */
arch_context_slow = 2, arch_context_slow = 2, /* Saved a slowpath context */
arch_context_running = 3 arch_context_running = 3 /* Context is executing and content is out of date */
} arch_context_t; } arch_context_t;

@ -53,6 +53,7 @@ arch_mcontext_restore(mcontext_t *active_context, struct arch_context *sandbox_c
/* Restore mcontext */ /* Restore mcontext */
memcpy(active_context, &sandbox_context->mctx, sizeof(mcontext_t)); memcpy(active_context, &sandbox_context->mctx, sizeof(mcontext_t));
memset(&sandbox_context->mctx, 0, sizeof(mcontext_t)); memset(&sandbox_context->mctx, 0, sizeof(mcontext_t));
sandbox_context->variant = arch_context_running;
} }
/** /**
@ -77,6 +78,7 @@ arch_context_restore(mcontext_t *active_context, struct arch_context *sandbox_co
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_rsp] = 0;
sandbox_context->regs[ureg_rip] = 0; sandbox_context->regs[ureg_rip] = 0;
sandbox_context->variant = arch_context_running;
} }
/** /**

Loading…
Cancel
Save