예제 #1
0
/* TODO:(igkang) context switching related fucntions should be redesigned
 *
 * in scheduler.c
 *   - perform_switch
 *   - guest_perform_switch
 *   - sched_policy_determ_next
 *   - guest_switchto
 *
 * and outside of scheduler.c
 *   - context_switch_to
 */
static hvmm_status_t perform_switch(struct core_regs *regs, vmid_t next_vmid)
{
    /* _curreng_guest_vmid -> next_vmid */

    hvmm_status_t result = HVMM_STATUS_UNKNOWN_ERROR;
    uint32_t cpu = smp_processor_id();
    vmid_t currentcurrent = VMID_INVALID;

    if (_current_guest_vmid[cpu] == next_vmid)
        return HVMM_STATUS_IGNORED;

    currentcurrent = _current_guest_vmid[cpu];
    _current_guest_vmid[cpu] = next_vmid;
    context_switch_to(currentcurrent, next_vmid, regs);

    return result;
}
예제 #2
0
파일: proc.c 프로젝트: jack2684/yalnix
/* schedule a specific process
 */
void pick_schedule(UserContext *user_context, pcb_t *next_proc) {
    context_switch_to(next_proc, user_context);
    restore_user_runtime(running_proc, user_context);
}