Fix vector interrupt handling

Don't produce stray irq 5, don't overwrite ivec_data if still busy with
processing of the previous interrupt.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Artyom Tarasenko 2012-04-03 17:49:04 +02:00 committed by Blue Swirl
parent f05f6b4adb
commit 23cf96e197

View File

@ -309,19 +309,22 @@ static void cpu_set_ivec_irq(void *opaque, int irq, int level)
CPUSPARCState *env = opaque; CPUSPARCState *env = opaque;
if (level) { if (level) {
CPUIRQ_DPRINTF("Raise IVEC IRQ %d\n", irq); if (!(env->ivec_status & 0x20)) {
env->interrupt_index = TT_IVEC; CPUIRQ_DPRINTF("Raise IVEC IRQ %d\n", irq);
env->pil_in |= 1 << 5; env->halted = 0;
env->ivec_status |= 0x20; env->interrupt_index = TT_IVEC;
env->ivec_data[0] = (0x1f << 6) | irq; env->ivec_status |= 0x20;
env->ivec_data[1] = 0; env->ivec_data[0] = (0x1f << 6) | irq;
env->ivec_data[2] = 0; env->ivec_data[1] = 0;
cpu_interrupt(env, CPU_INTERRUPT_HARD); env->ivec_data[2] = 0;
} else { cpu_interrupt(env, CPU_INTERRUPT_HARD);
CPUIRQ_DPRINTF("Lower IVEC IRQ %d\n", irq); }
env->pil_in &= ~(1 << 5); } else {
env->ivec_status &= ~0x20; if (env->ivec_status & 0x20) {
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); CPUIRQ_DPRINTF("Lower IVEC IRQ %d\n", irq);
env->ivec_status &= ~0x20;
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
}
} }
} }