From 42566b1c6ecbe41ee9ade9559a53b4078800127c Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Sat, 18 Jul 2020 14:42:09 -0400 Subject: [PATCH] chore: comment context variants and use running --- runtime/include/arch/common.h | 8 ++++---- runtime/include/arch/context.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/runtime/include/arch/common.h b/runtime/include/arch/common.h index edd867d..6dfb1ba 100644 --- a/runtime/include/arch/common.h +++ b/runtime/include/arch/common.h @@ -30,10 +30,10 @@ typedef enum /* The enum is compared directly in assembly, so maintain integral values! */ typedef enum { - arch_context_unused = 0, - arch_context_fast = 1, - arch_context_slow = 2, - arch_context_running = 3 + arch_context_unused = 0, /* Has not have saved a context */ + arch_context_fast = 1, /* Saved a fastpath context */ + arch_context_slow = 2, /* Saved a slowpath context */ + arch_context_running = 3 /* Context is executing and content is out of date */ } arch_context_t; diff --git a/runtime/include/arch/context.h b/runtime/include/arch/context.h index 1653e51..43f5534 100644 --- a/runtime/include/arch/context.h +++ b/runtime/include/arch/context.h @@ -53,6 +53,7 @@ arch_mcontext_restore(mcontext_t *active_context, struct arch_context *sandbox_c /* Restore mcontext */ memcpy(active_context, &sandbox_context->mctx, 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; sandbox_context->regs[ureg_rsp] = 0; sandbox_context->regs[ureg_rip] = 0; + sandbox_context->variant = arch_context_running; } /**