static void ppc_hw_interrupt(CPUPPCState *env)

{

    PowerPCCPU *cpu = ppc_env_get_cpu(env);

    int hdice;

#if 0

    CPUState *cs = CPU(cpu);



    qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n",

                  __func__, env, env->pending_interrupts,

                  cs->interrupt_request, (int)msr_me, (int)msr_ee);

#endif

    /* External reset */

    if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) {

        env->pending_interrupts &= ~(1 << PPC_INTERRUPT_RESET);

        powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_RESET);

        return;

    }

    /* Machine check exception */

    if (env->pending_interrupts & (1 << PPC_INTERRUPT_MCK)) {

        env->pending_interrupts &= ~(1 << PPC_INTERRUPT_MCK);

        powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_MCHECK);

        return;

    }

#if 0 /* TODO */

    /* External debug exception */

    if (env->pending_interrupts & (1 << PPC_INTERRUPT_DEBUG)) {

        env->pending_interrupts &= ~(1 << PPC_INTERRUPT_DEBUG);

        powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DEBUG);

        return;

    }

#endif

    if (0) {

        /* XXX: find a suitable condition to enable the hypervisor mode */

        hdice = env->spr[SPR_LPCR] & 1;

    } else {

        hdice = 0;

    }

    if ((msr_ee != 0 || msr_hv == 0 || msr_pr != 0) && hdice != 0) {

        /* Hypervisor decrementer exception */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_HDECR)) {

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_HDECR);

            return;

        }

    }

    if (msr_ce != 0) {

        /* External critical interrupt */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_CEXT)) {

            /* Taking a critical external interrupt does not clear the external

             * critical interrupt status

             */

#if 0

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_CEXT);

#endif

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_CRITICAL);

            return;

        }

    }

    if (msr_ee != 0) {

        /* Watchdog timer on embedded PowerPC */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_WDT)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_WDT);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_WDT);

            return;

        }

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_CDOORBELL)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_CDOORBELL);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DOORCI);

            return;

        }

        /* Fixed interval timer on embedded PowerPC */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_FIT)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_FIT);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_FIT);

            return;

        }

        /* Programmable interval timer on embedded PowerPC */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_PIT)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_PIT);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_PIT);

            return;

        }

        /* Decrementer exception */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_DECR)) {

            if (ppc_decr_clear_on_delivery(env)) {

                env->pending_interrupts &= ~(1 << PPC_INTERRUPT_DECR);

            }

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DECR);

            return;

        }

        /* External interrupt */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_EXT)) {

            /* Taking an external interrupt does not clear the external

             * interrupt status

             */

#if 0

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_EXT);

#endif

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_EXTERNAL);

            return;

        }

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_DOORBELL)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_DOORBELL);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DOORI);

            return;

        }

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_PERFM)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_PERFM);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_PERFM);

            return;

        }

        /* Thermal interrupt */

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_THERM)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_THERM);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_THERM);

            return;

        }

    }

}

static void ppc_hw_interrupt(CPUPPCState *env)

{

    PowerPCCPU *cpu = ppc_env_get_cpu(env);

    int hdice;

#if 0

    CPUState *cs = CPU(cpu);



    qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n",

                  __func__, env, env->pending_interrupts,

                  cs->interrupt_request, (int)msr_me, (int)msr_ee);

#endif

    

    if (env->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) {

        env->pending_interrupts &= ~(1 << PPC_INTERRUPT_RESET);

        powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_RESET);

        return;

    }

    

    if (env->pending_interrupts & (1 << PPC_INTERRUPT_MCK)) {

        env->pending_interrupts &= ~(1 << PPC_INTERRUPT_MCK);

        powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_MCHECK);

        return;

    }

#if 0 

    

    if (env->pending_interrupts & (1 << PPC_INTERRUPT_DEBUG)) {

        env->pending_interrupts &= ~(1 << PPC_INTERRUPT_DEBUG);

        powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DEBUG);

        return;

    }

#endif

    if (0) {

        

        hdice = env->spr[SPR_LPCR] & 1;

    } else {

        hdice = 0;

    }

    if ((msr_ee != 0 || msr_hv == 0 || msr_pr != 0) && hdice != 0) {

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_HDECR)) {

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_HDECR);

            return;

        }

    }

    if (msr_ce != 0) {

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_CEXT)) {

            





#if 0

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_CEXT);

#endif

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_CRITICAL);

            return;

        }

    }

    if (msr_ee != 0) {

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_WDT)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_WDT);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_WDT);

            return;

        }

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_CDOORBELL)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_CDOORBELL);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DOORCI);

            return;

        }

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_FIT)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_FIT);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_FIT);

            return;

        }

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_PIT)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_PIT);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_PIT);

            return;

        }

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_DECR)) {

            if (ppc_decr_clear_on_delivery(env)) {

                env->pending_interrupts &= ~(1 << PPC_INTERRUPT_DECR);

            }

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DECR);

            return;

        }

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_EXT)) {

            





#if 0

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_EXT);

#endif

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_EXTERNAL);

            return;

        }

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_DOORBELL)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_DOORBELL);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_DOORI);

            return;

        }

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_PERFM)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_PERFM);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_PERFM);

            return;

        }

        

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_THERM)) {

            env->pending_interrupts &= ~(1 << PPC_INTERRUPT_THERM);

            powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_THERM);

            return;

        }

    }

}

        if (env->pending_interrupts & (1 << PPC_INTERRUPT_EXT)) { #if 0             env->pending_interrupts &= ~(1 << PPC_INTERRUPT_EXT); #endif             powerpc_excp(cpu, env->excp_model, POWERPC_EXCP_EXTERNAL);
static void FUNC_0(CPUPPCState *VAR_0)

{

    PowerPCCPU *cpu = ppc_env_get_cpu(VAR_0);

    int VAR_1;

#if 0

    CPUState *cs = CPU(cpu);



    qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n",

                  __func__, VAR_0, VAR_0->pending_interrupts,

                  cs->interrupt_request, (int)msr_me, (int)msr_ee);

#endif

    

    if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) {

        VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_RESET);

        powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_RESET);

        return;

    }

    

    if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_MCK)) {

        VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_MCK);

        powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_MCHECK);

        return;

    }

#if 0 

    

    if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_DEBUG)) {

        VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_DEBUG);

        powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DEBUG);

        return;

    }

#endif

    if (0) {

        

        VAR_1 = VAR_0->spr[SPR_LPCR] & 1;

    } else {

        VAR_1 = 0;

    }

    if ((msr_ee != 0 || msr_hv == 0 || msr_pr != 0) && VAR_1 != 0) {

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_HDECR)) {

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_HDECR);

            return;

        }

    }

    if (msr_ce != 0) {

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_CEXT)) {

            





#if 0

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_CEXT);

#endif

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_CRITICAL);

            return;

        }

    }

    if (msr_ee != 0) {

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_WDT)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_WDT);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_WDT);

            return;

        }

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_CDOORBELL)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_CDOORBELL);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DOORCI);

            return;

        }

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_FIT)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_FIT);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_FIT);

            return;

        }

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_PIT)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_PIT);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_PIT);

            return;

        }

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_DECR)) {

            if (ppc_decr_clear_on_delivery(VAR_0)) {

                VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_DECR);

            }

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DECR);

            return;

        }

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_EXT)) {

            





#if 0

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_EXT);

#endif

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_EXTERNAL);

            return;

        }

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_DOORBELL)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_DOORBELL);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DOORI);

            return;

        }

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_PERFM)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_PERFM);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_PERFM);

            return;

        }

        

        if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_THERM)) {

            VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_THERM);

            powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_THERM);

            return;

        }

    }

}

static void FUNC_0(CPUPPCState *VAR_0)
{ PowerPCCPU *cpu = ppc_env_get_cpu(VAR_0); int VAR_1; #if 0
CPUState *cs = CPU(cpu); qemu_log_mask(CPU_LOG_INT, "%s: %p pending %08x req %08x me %d ee %d\n",
__func__, VAR_0, VAR_0->pending_interrupts,
cs->interrupt_request, (int)msr_me, (int)msr_ee); #endif
if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_RESET)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_RESET); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_RESET); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_MCK)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_MCK); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_MCHECK); return; } #if 0
if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_DEBUG)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_DEBUG); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DEBUG); return; } #endif
if (0) { VAR_1 = VAR_0->spr[SPR_LPCR] & 1; } else { VAR_1 = 0; } if ((msr_ee != 0 || msr_hv == 0 || msr_pr != 0) && VAR_1 != 0) { if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_HDECR)) { powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_HDECR); return; } } if (msr_ce != 0) { if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_CEXT)) { #if 0
VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_CEXT); #endif
powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_CRITICAL); return; } } if (msr_ee != 0) { if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_WDT)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_WDT); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_WDT); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_CDOORBELL)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_CDOORBELL); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DOORCI); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_FIT)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_FIT); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_FIT); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_PIT)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_PIT); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_PIT); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_DECR)) { if (ppc_decr_clear_on_delivery(VAR_0)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_DECR); } powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DECR); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_EXT)) { #if 0
VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_EXT); #endif
powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_EXTERNAL); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_DOORBELL)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_DOORBELL); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_DOORI); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_PERFM)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_PERFM); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_PERFM); return; } if (VAR_0->pending_interrupts & (1 << PPC_INTERRUPT_THERM)) { VAR_0->pending_interrupts &= ~(1 << PPC_INTERRUPT_THERM); powerpc_excp(cpu, VAR_0->excp_model, POWERPC_EXCP_THERM); return; } } }