refactor: remove extraneous zeroing out

main
Sean McBride 4 years ago
parent 3f4567ea6e
commit 859e87f425

@ -17,9 +17,6 @@ arch_context_init(struct arch_context *actx, reg_t ip, reg_t sp)
{ {
assert(actx->variant == arch_context_unused); assert(actx->variant == arch_context_unused);
memset(&actx->mctx, 0, sizeof(mcontext_t));
memset((void *)actx->regs, 0, sizeof(reg_t) * ureg_count);
actx->regs[ureg_rsp] = sp; actx->regs[ureg_rsp] = sp;
actx->regs[ureg_rip] = ip; actx->regs[ureg_rip] = ip;
actx->variant = arch_context_fast; actx->variant = arch_context_fast;

@ -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));

@ -14,9 +14,6 @@
*/ */
static void __attribute__((noinline)) arch_context_init(struct arch_context *actx, reg_t ip, reg_t sp) static void __attribute__((noinline)) arch_context_init(struct arch_context *actx, reg_t ip, reg_t sp)
{ {
memset(&actx->mctx, 0, sizeof(mcontext_t));
memset((void *)actx->regs, 0, sizeof(reg_t) * ureg_count);
if (sp) { if (sp) {
/* /*
* context_switch conventions: bp is expected to be on top of the stack * context_switch conventions: bp is expected to be on top of the stack

Loading…
Cancel
Save