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

{

    struct qemu_work_item wi;



    if (qemu_cpu_is_self(cpu)) {

        func(data);

        return;

    }



    wi.func = func;

    wi.data = data;

    wi.free = false;

    if (cpu->queued_work_first == NULL) {

        cpu->queued_work_first = &wi;

    } else {

        cpu->queued_work_last->next = &wi;

    }

    cpu->queued_work_last = &wi;

    wi.next = NULL;

    wi.done = false;



    qemu_cpu_kick(cpu);

    while (!wi.done) {

        CPUState *self_cpu = current_cpu;



        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);

        current_cpu = self_cpu;

    }

}

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

{

    struct qemu_work_item wi;



    if (qemu_cpu_is_self(cpu)) {

        func(data);

        return;

    }



    wi.func = func;

    wi.data = data;

    wi.free = false;

    if (cpu->queued_work_first == NULL) {

        cpu->queued_work_first = &wi;

    } else {

        cpu->queued_work_last->next = &wi;

    }

    cpu->queued_work_last = &wi;

    wi.next = NULL;

    wi.done = false;



    qemu_cpu_kick(cpu);

    while (!wi.done) {

        CPUState *self_cpu = current_cpu;



        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);

        current_cpu = self_cpu;

    }

}

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

{

    struct qemu_work_item VAR_3;



    if (qemu_cpu_is_self(VAR_0)) {

        VAR_1(VAR_3);

        return;

    }



    VAR_3.VAR_1 = VAR_1;

    VAR_3.VAR_3 = VAR_3;

    VAR_3.free = false;

    if (VAR_0->queued_work_first == NULL) {

        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_cpu = current_cpu;



        qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex);

        current_cpu = self_cpu;

    }

}

void FUNC_0(CPUState *VAR_0, void (*VAR_1)(void *VAR_3), void *VAR_3)
{ struct qemu_work_item VAR_3; if (qemu_cpu_is_self(VAR_0)) { VAR_1(VAR_3); return; } VAR_3.VAR_1 = VAR_1; VAR_3.VAR_3 = VAR_3; VAR_3.free = false; if (VAR_0->queued_work_first == NULL) { 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_cpu = current_cpu; qemu_cond_wait(&qemu_work_cond, &qemu_global_mutex); current_cpu = self_cpu; } }