示例#1
0
文件: context.c 项目: xinhaoyuan/cox
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);
    }
}
示例#2
0
文件: domain.c 项目: Marshalzxy/xen
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);
}
示例#3
0
void Context::jump(void* location, context_func func)
{
  // switch to stack from @location
  __context_switch((uintptr_t) location, func);
}