Exemplo n.º 1
0
/* Switch to the first guest */
void guest_sched_start(void)
{
    struct vcpu *vcpu = 0;
    uint32_t cpu = smp_processor_id();

    printf("[hyp] switch_to_initial_guest:\n");
    /* Select the first guest context to switch to. */
    _current_guest_vmid[cpu] = VMID_INVALID;
    if (cpu)
        vcpu = vcpu_find(2);
    else
        vcpu = vcpu_find(0);

    guest_switchto(vcpu->vcpuid);
    guest_perform_switch(&vcpu->vcpu_regs.core_regs);
}
Exemplo n.º 2
0
/**
 * Main scheduler routine
 *
 * @param
 * @return
 */
void do_schedule(void *pdata)
{
    /* TODO:(igkang) function type(return/param) should be renewed */
    int next_vcpuid;

    /* get assigned scheduling policy of pCPU? */

    /* determine next vcpu to be run
     * by calling scheduler.do_schedule() */
    next_vcpuid = sched_rr.do_schedule();

    /* update vCPU's running time */

    /* manipulate variables to
     * cause context switch */

    guest_switchto(next_vcpuid);
}
Exemplo n.º 3
0
void interrupt_nsptimer(int irq, void *pregs, void *pdata)
{
    uint32_t ctl;
    struct arch_regs *regs = pregs;
    uart_print("=======================================\n\r");
    HVMM_TRACE_ENTER();
    /* Disable NS Physical Timer Interrupt */
    ctl = read_cntp_ctl();
    ctl &= ~(0x1);
    write_cntp_ctl(ctl);
    /* Trigger another interrupt */
    test_start_timer();
    /* Test guest context switch */
    if ((regs->cpsr & 0x1F) != 0x1A) {
        /* Not from Hyp, switch the guest context */
        guest_dump_regs(regs);
        guest_switchto(sched_policy_determ_next(), 0);
    }
    HVMM_TRACE_EXIT();
    uart_print("=======================================\n\r");
}