void context_switch(context_t old, context_t to) { if (old != NULL) { __context_switch(&old->stk_ptr, &old->pc, to->stk_ptr, to->pc); } else { uintptr_t __unused; __context_switch(&__unused, &__unused, to->stk_ptr, to->pc); } }
void context_switch(struct vcpu *prev, struct vcpu *next) { ASSERT(local_irq_is_enabled()); ASSERT(prev != next); ASSERT(cpumask_empty(next->vcpu_dirty_cpumask)); if ( prev != next ) update_runstate_area(prev); local_irq_disable(); set_current(next); prev = __context_switch(prev, next); schedule_tail(prev); }
void Context::jump(void* location, context_func func) { // switch to stack from @location __context_switch((uintptr_t) location, func); }