refactor: arch_context_unused error handling

main
Sean McBride 4 years ago
parent 9a963f1d0c
commit 9dc6d8dd8a

@ -15,6 +15,8 @@
static inline void static inline void
arch_context_init(struct arch_context *actx, reg_t ip, reg_t sp) arch_context_init(struct arch_context *actx, reg_t ip, reg_t sp)
{ {
assert(actx->variant == arch_context_unused);
memset(&actx->mctx, 0, sizeof(mcontext_t)); memset(&actx->mctx, 0, sizeof(mcontext_t));
memset((void *)actx->regs, 0, sizeof(reg_t) * ureg_count); memset((void *)actx->regs, 0, sizeof(reg_t) * ureg_count);

@ -72,7 +72,7 @@ arch_context_switch(struct arch_context *current, struct arch_context *next)
if (next == NULL) next = &worker_thread_base_context; if (next == NULL) next = &worker_thread_base_context;
/* Assumption: The context we are switching to should have saved a context in some form */ /* Assumption: The context we are switching to should have saved a context in some form */
assert(next->variant == arch_context_fast || next->variant != arch_context_unused); assert(next->variant == arch_context_fast || next->variant == arch_context_slow);
reg_t *current_registers = current->regs, *next_registers = next->regs; reg_t *current_registers = current->regs, *next_registers = next->regs;
assert(current_registers && next_registers); assert(current_registers && next_registers);

Loading…
Cancel
Save