static void apic_bus_deliver(const uint32_t *deliver_bitmask,

                             uint8_t delivery_mode,

                             uint8_t vector_num, uint8_t polarity,

                             uint8_t trigger_mode)

{

    APICState *apic_iter;



    switch (delivery_mode) {

        case APIC_DM_LOWPRI:

            /* XXX: search for focus processor, arbitration */

            {

                int i, d;

                d = -1;

                for(i = 0; i < MAX_APIC_WORDS; i++) {

                    if (deliver_bitmask[i]) {

                        d = i * 32 + ffs_bit(deliver_bitmask[i]);

                        break;

                    }

                }

                if (d >= 0) {

                    apic_iter = local_apics[d];

                    if (apic_iter) {

                        apic_set_irq(apic_iter, vector_num, trigger_mode);

                    }

                }

            }

            return;



        case APIC_DM_FIXED:

            break;



        case APIC_DM_SMI:

            foreach_apic(apic_iter, deliver_bitmask,

                cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) );

            return;



        case APIC_DM_NMI:

            foreach_apic(apic_iter, deliver_bitmask,

                cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) );

            return;



        case APIC_DM_INIT:

            /* normal INIT IPI sent to processors */

            foreach_apic(apic_iter, deliver_bitmask,

                         apic_init_ipi(apic_iter) );

            return;



        case APIC_DM_EXTINT:

            /* handled in I/O APIC code */

            break;



        default:

            return;

    }



    foreach_apic(apic_iter, deliver_bitmask,

                 apic_set_irq(apic_iter, vector_num, trigger_mode) );

}

static void apic_bus_deliver(const uint32_t *deliver_bitmask,

                             uint8_t delivery_mode,

                             uint8_t vector_num, uint8_t polarity,

                             uint8_t trigger_mode)

{

    APICState *apic_iter;



    switch (delivery_mode) {

        case APIC_DM_LOWPRI:

            

            {

                int i, d;

                d = -1;

                for(i = 0; i < MAX_APIC_WORDS; i++) {

                    if (deliver_bitmask[i]) {

                        d = i * 32 + ffs_bit(deliver_bitmask[i]);

                        break;

                    }

                }

                if (d >= 0) {

                    apic_iter = local_apics[d];

                    if (apic_iter) {

                        apic_set_irq(apic_iter, vector_num, trigger_mode);

                    }

                }

            }

            return;



        case APIC_DM_FIXED:

            break;



        case APIC_DM_SMI:

            foreach_apic(apic_iter, deliver_bitmask,

                cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) );

            return;



        case APIC_DM_NMI:

            foreach_apic(apic_iter, deliver_bitmask,

                cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) );

            return;



        case APIC_DM_INIT:

            

            foreach_apic(apic_iter, deliver_bitmask,

                         apic_init_ipi(apic_iter) );

            return;



        case APIC_DM_EXTINT:

            

            break;



        default:

            return;

    }



    foreach_apic(apic_iter, deliver_bitmask,

                 apic_set_irq(apic_iter, vector_num, trigger_mode) );

}

static void FUNC_0(const uint32_t *VAR_0,

                             uint8_t VAR_1,

                             uint8_t VAR_2, uint8_t VAR_3,

                             uint8_t VAR_4)

{

    APICState *apic_iter;



    switch (VAR_1) {

        case APIC_DM_LOWPRI:

            

            {

                int VAR_5, VAR_6;

                VAR_6 = -1;

                for(VAR_5 = 0; VAR_5 < MAX_APIC_WORDS; VAR_5++) {

                    if (VAR_0[VAR_5]) {

                        VAR_6 = VAR_5 * 32 + ffs_bit(VAR_0[VAR_5]);

                        break;

                    }

                }

                if (VAR_6 >= 0) {

                    apic_iter = local_apics[VAR_6];

                    if (apic_iter) {

                        apic_set_irq(apic_iter, VAR_2, VAR_4);

                    }

                }

            }

            return;



        case APIC_DM_FIXED:

            break;



        case APIC_DM_SMI:

            foreach_apic(apic_iter, VAR_0,

                cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) );

            return;



        case APIC_DM_NMI:

            foreach_apic(apic_iter, VAR_0,

                cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) );

            return;



        case APIC_DM_INIT:

            

            foreach_apic(apic_iter, VAR_0,

                         apic_init_ipi(apic_iter) );

            return;



        case APIC_DM_EXTINT:

            

            break;



        default:

            return;

    }



    foreach_apic(apic_iter, VAR_0,

                 apic_set_irq(apic_iter, VAR_2, VAR_4) );

}

static void FUNC_0(const uint32_t *VAR_0,
uint8_t VAR_1,
uint8_t VAR_2, uint8_t VAR_3,
uint8_t VAR_4)
{ APICState *apic_iter; switch (VAR_1) { case APIC_DM_LOWPRI:
{ int VAR_5, VAR_6; VAR_6 = -1; for(VAR_5 = 0; VAR_5 < MAX_APIC_WORDS; VAR_5++) { if (VAR_0[VAR_5]) { VAR_6 = VAR_5 * 32 + ffs_bit(VAR_0[VAR_5]); break; } } if (VAR_6 >= 0) { apic_iter = local_apics[VAR_6]; if (apic_iter) { apic_set_irq(apic_iter, VAR_2, VAR_4); } } } return; case APIC_DM_FIXED:
break; case APIC_DM_SMI:
foreach_apic(apic_iter, VAR_0,
cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_SMI) ); return; case APIC_DM_NMI:
foreach_apic(apic_iter, VAR_0,
cpu_interrupt(apic_iter->cpu_env, CPU_INTERRUPT_NMI) ); return; case APIC_DM_INIT:
foreach_apic(apic_iter, VAR_0,
apic_init_ipi(apic_iter) ); return; case APIC_DM_EXTINT:
break; default:
return; } foreach_apic(apic_iter, VAR_0,
apic_set_irq(apic_iter, VAR_2, VAR_4) ); }