void run_on_cpu(CPUState *env, void (*func)(void *data), void *data)

{

    struct qemu_work_item wi;



    if (qemu_cpu_self(env)) {

        func(data);

        return;

    }



    wi.func = func;

    wi.data = data;

    if (!env->queued_work_first)

        env->queued_work_first = &wi;

    else

        env->queued_work_last->next = &wi;

    env->queued_work_last = &wi;

    wi.next = NULL;

    wi.done = false;



    qemu_cpu_kick(env);

    while (!wi.done) {

        CPUState *self_env = cpu_single_env;



        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);

        cpu_single_env = self_env;

    }

}

void run_on_cpu(CPUState *env, void (*func)(void *data), void *data)

{

    struct qemu_work_item wi;



    if (qemu_cpu_self(env)) {

        func(data);

        return;

    }



    wi.func = func;

    wi.data = data;

    if (!env->queued_work_first)

        env->queued_work_first = &wi;

    else

        env->queued_work_last->next = &wi;

    env->queued_work_last = &wi;

    wi.next = NULL;

    wi.done = false;



    qemu_cpu_kick(env);

    while (!wi.done) {

        CPUState *self_env = cpu_single_env;



        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);

        cpu_single_env = self_env;

    }

}

void FUNC_0(CPUState *VAR_0, void (*VAR_1)(void *VAR_3), void *VAR_3)

{

    struct qemu_work_item VAR_3;



    if (qemu_cpu_self(VAR_0)) {

        VAR_1(VAR_3);

        return;

    }



    VAR_3.VAR_1 = VAR_1;

    VAR_3.VAR_3 = VAR_3;

    if (!VAR_0->queued_work_first)

        VAR_0->queued_work_first = &VAR_3;

    else

        VAR_0->queued_work_last->next = &VAR_3;

    VAR_0->queued_work_last = &VAR_3;

    VAR_3.next = NULL;

    VAR_3.done = false;



    qemu_cpu_kick(VAR_0);

    while (!VAR_3.done) {

        CPUState *self_env = cpu_single_env;



        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);

        cpu_single_env = self_env;

    }

}

void FUNC_0(CPUState *VAR_0, void (*VAR_1)(void *VAR_3), void *VAR_3)
{ struct qemu_work_item VAR_3; if (qemu_cpu_self(VAR_0)) { VAR_1(VAR_3); return; } VAR_3.VAR_1 = VAR_1; VAR_3.VAR_3 = VAR_3; if (!VAR_0->queued_work_first)
VAR_0->queued_work_first = &VAR_3; else
VAR_0->queued_work_last->next = &VAR_3; VAR_0->queued_work_last = &VAR_3; VAR_3.next = NULL; VAR_3.done = false; qemu_cpu_kick(VAR_0); while (!VAR_3.done) { CPUState *self_env = cpu_single_env; qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex); cpu_single_env = self_env; } }