Exemplo n.º 1
0
bool tcg_cpu_exec(void)
{
    int ret = 0;

    if (next_cpu == NULL)
        next_cpu = first_cpu;
    for (; next_cpu != NULL; next_cpu = next_cpu->next_cpu) {
        CPUState *env = cur_cpu = next_cpu;

        qemu_clock_enable(vm_clock,
                          (cur_cpu->singlestep_enabled & SSTEP_NOTIMER) == 0);

        if (qemu_alarm_pending())
            break;
        if (cpu_can_run(env))
            ret = qemu_cpu_exec(env);
        else if (env->stop)
            break;

        if (ret == EXCP_DEBUG) {
            gdb_set_stop_cpu(env);
            debug_requested = EXCP_DEBUG;
            break;
        }
    }
    return tcg_has_work();
}
Exemplo n.º 2
0
bool cpu_exec_all (void)
{
    static int i = 0;

    if (next_cpu == NULL) {
        next_cpu = first_cpu;
        i = 0;
    }
     for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu, i++) {
        CPUState *env = next_cpu;

        rr_run = env->kvm_run;
        cpu_number = i;
        qemu_clock_enable(vm_clock,
                          (env->singlestep_enabled & SSTEP_NOTIMER) == 0);

        if (qemu_alarm_pending())
            break;
        if (cpu_can_run(env)) {
            if (qemu_cpu_exec(env) == EXCP_DEBUG) {
                break;
            }
        } else if (env->stop) {
            break;
        }
    }
    exit_request = 0;
    return any_cpu_has_work();
}
Exemplo n.º 3
0
Arquivo: cpus.c Projeto: linuxcer/qemu
bool cpu_exec_all(void)
{
    int r;

    /* Account partial waits to the vm_clock.  */
    qemu_clock_warp(vm_clock);

    if (next_cpu == NULL) {
        next_cpu = first_cpu;
    }
    for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu) {
        CPUState *env = next_cpu;

        qemu_clock_enable(vm_clock,
                          (env->singlestep_enabled & SSTEP_NOTIMER) == 0);

#ifndef CONFIG_IOTHREAD
        if (qemu_alarm_pending()) {
            break;
        }
#endif
        if (cpu_can_run(env)) {
            if (kvm_enabled()) {
                r = kvm_cpu_exec(env);
                qemu_kvm_eat_signals(env);
            } else {
                r = tcg_cpu_exec(env);
            }
            if (r == EXCP_TRIPLE) {
                cpu_dump_state(env, stderr, fprintf, 0);
                fprintf(stderr, "Triple fault.  Halting for inspection via"
                        " QEMU monitor.\n");
                if (gdbserver_running())
                    r = EXCP_DEBUG;
                else {
                    vm_stop(0);
                    break;
                }
            }
            if (r == EXCP_DEBUG) {
                cpu_handle_guest_debug(env);
                break;
            }
        } else if (env->stop || env->stopped) {
            break;
        }
    }
    exit_request = 0;
    return !all_cpu_threads_idle();
}
Exemplo n.º 4
0
bool cpu_exec_all(void)
{
    int r;

    /* Account partial waits to the vm_clock.  */
    qemu_clock_warp(vm_clock);

    if (next_cpu == NULL) {
        next_cpu = first_cpu;
    }
    for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu) {
        CPUState *env = next_cpu;

        qemu_clock_enable(vm_clock,
                          (env->singlestep_enabled & SSTEP_NOTIMER) == 0);

#ifndef CONFIG_IOTHREAD
        if (qemu_alarm_pending()) {
            break;
        }
#endif
        if (cpu_can_run(env)) {
            if (kvm_enabled()) {
                r = kvm_cpu_exec(env);
                qemu_kvm_eat_signals(env);
            } else {
                r = tcg_cpu_exec(env);
            }
            if (r == EXCP_DEBUG) {
                cpu_handle_guest_debug(env);
                break;
            }
        } else if (env->stop || env->stopped) {
            break;
        }
    }
    if (tlm_sync) {
        tlm_sync(tlm_opaque, qemu_get_clock_ns(vm_clock));
    }
    exit_request = 0;
    return !all_cpu_threads_idle();
}
Exemplo n.º 5
0
bool cpu_exec_all(void)
{
    if (next_cpu == NULL)
        next_cpu = first_cpu;
    for (; next_cpu != NULL && !exit_request; next_cpu = next_cpu->next_cpu) {
        CPUState *env = next_cpu;

        qemu_clock_enable(vm_clock,
                          (env->singlestep_enabled & SSTEP_NOTIMER) == 0);

        if (qemu_alarm_pending())
            break;
        if (cpu_can_run(env)) {
            if (qemu_cpu_exec(env) == EXCP_DEBUG) {
                break;
            }
        } else if (env->stop) {
#ifdef MARSS_QEMU
			continue; /* Let other CPUS execute */
#else
            break;
#endif
        }

#ifdef MARSS_QEMU
        if (in_simulation)
          /* No need to run for other cpus */
          break;
#endif

    }
#ifdef MARSS_QEMU
	if (!any_cpu_has_work()) {
		/* All CPUs are paused, call ptl_simpoint reached
		 * to check if we need to switch to simulation or not */
		ptl_simpoint_reached(0);
	}
#endif
    exit_request = 0;
    return any_cpu_has_work();
}