示例#1
0
void pause_all_vcpus(void)
{
    CPUArchState *penv = first_cpu;

    qemu_clock_enable(vm_clock, false);
    while (penv) {
        CPUState *pcpu = ENV_GET_CPU(penv);
        pcpu->stop = true;
        qemu_cpu_kick(pcpu);
        penv = penv->next_cpu;
    }

    if (qemu_in_vcpu_thread()) {
        cpu_stop_current();
        if (!kvm_enabled()) {
            while (penv) {
                CPUState *pcpu = ENV_GET_CPU(penv);
                pcpu->stop = 0;
                pcpu->stopped = true;
                penv = penv->next_cpu;
            }
            return;
        }
    }

    while (!all_vcpus_paused()) {
        qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
        penv = first_cpu;
        while (penv) {
            qemu_cpu_kick(ENV_GET_CPU(penv));
            penv = penv->next_cpu;
        }
    }
}
示例#2
0
void pause_all_vcpus(void)
{
    CPUArchState *penv = first_cpu;

    qemu_clock_enable(vm_clock, false);
    while (penv) {
        penv->stop = 1;
        qemu_cpu_kick(penv);
        penv = penv->next_cpu;
    }

    if (!qemu_thread_is_self(&io_thread)) {
        cpu_stop_current();
        if (!kvm_enabled()) {
            while (penv) {
                penv->stop = 0;
                penv->stopped = 1;
                penv = penv->next_cpu;
            }
            return;
        }
    }

    while (!all_vcpus_paused()) {
        qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
        penv = first_cpu;
        while (penv) {
            qemu_cpu_kick(penv);
            penv = penv->next_cpu;
        }
    }
}
示例#3
0
文件: cpus.c 项目: zhouy-fnst/qemu
void pause_all_vcpus(void)
{
    CPUState *cpu = first_cpu;

    qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false);
    while (cpu) {
        cpu->stop = true;
        qemu_cpu_kick(cpu);
        cpu = cpu->next_cpu;
    }

    if (qemu_in_vcpu_thread()) {
        cpu_stop_current();
        if (!kvm_enabled()) {
            cpu = first_cpu;
            while (cpu) {
                cpu->stop = false;
                cpu->stopped = true;
                cpu = cpu->next_cpu;
            }
            return;
        }
    }

    while (!all_vcpus_paused()) {
        qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
        cpu = first_cpu;
        while (cpu) {
            qemu_cpu_kick(cpu);
            cpu = cpu->next_cpu;
        }
    }
}
示例#4
0
static void rtas_power_off(PowerPCCPU *cpu, sPAPRMachineState *spapr,
                           uint32_t token, uint32_t nargs, target_ulong args,
                           uint32_t nret, target_ulong rets)
{
    if (nargs != 2 || nret != 1) {
        rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR);
        return;
    }
    qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
    cpu_stop_current();
    rtas_st(rets, 0, RTAS_OUT_SUCCESS);
}
示例#5
0
void vm_stop(RunState state)
{
    if (qemu_in_vcpu_thread()) {
        qemu_system_vmstop_request(state);
        /*
         * FIXME: should not return to device code in case
         * vm_stop() has been requested.
         */
        cpu_stop_current();
        return;
    }
    do_vm_stop(state);
}
示例#6
0
void vm_stop(int reason)
{
    if (!qemu_thread_is_self(&io_thread)) {
        qemu_system_vmstop_request(reason);
        /*
         * FIXME: should not return to device code in case
         * vm_stop() has been requested.
         */
        cpu_stop_current();
        return;
    }
    do_vm_stop(reason);
}
示例#7
0
文件: cpus.c 项目: 0bliv10n/s2e
void pause_all_vcpus(void)
{
    CPUArchState *penv = first_cpu;

    qemu_clock_enable(vm_clock, false);
    while (penv) {
#ifdef CONFIG_S2E_DEBUG
        s2e_debug_print("MAIN: pause_all_vcpus kiking cpus\n");
#endif
        penv->stop = 1;
        qemu_cpu_kick(penv);
        penv = penv->next_cpu;
    }

    if (!qemu_thread_is_self(&io_thread)) {
        cpu_stop_current();
        if (!kvm_enabled()) {
            while (penv) {
                penv->stop = 0;
                penv->stopped = 1;
                penv = penv->next_cpu;
            }
            return;
        }
    }

    while (!all_vcpus_paused()) {
#ifdef CONFIG_S2E_DEBUG
        s2e_debug_print("MAIN: pause_all_vcpus waiting for qemu_pause_cond\n");
#endif
        qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex);
        penv = first_cpu;
        while (penv) {
            qemu_cpu_kick(penv);
            penv = penv->next_cpu;
        }
    }
}
示例#8
0
文件: vl.c 项目: RKX1209/unicorn
void qemu_system_reset_request(struct uc_struct* uc)
{
    cpu_stop_current(uc);
}