aboutsummaryrefslogtreecommitdiff
path: root/hw/sun4m.c
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-08-04 10:50:30 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2007-08-04 10:50:30 +0000
commit327ac2e797ed57d7231d44c77a7473d62efe0989 (patch)
tree1809a94735d69b1ed2aa5fa39ddfdd76b0921df5 /hw/sun4m.c
parentccf1d14a1e37abe1f0da162c00a8941963b47a4c (diff)
Fix Sparc32 interrupt handling
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3110 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/sun4m.c')
-rw-r--r--hw/sun4m.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/hw/sun4m.c b/hw/sun4m.c
index eb69ef8e58..5974812670 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -240,26 +240,41 @@ void irq_info()
slavio_irq_info(slavio_intctl);
}
+void cpu_check_irqs(CPUState *env)
+{
+ if (env->pil_in && (env->interrupt_index == 0 ||
+ (env->interrupt_index & ~15) == TT_EXTINT)) {
+ unsigned int i;
+
+ for (i = 15; i > 0; i--) {
+ if (env->pil_in & (1 << i)) {
+ int old_interrupt = env->interrupt_index;
+
+ env->interrupt_index = TT_EXTINT | i;
+ if (old_interrupt != env->interrupt_index)
+ cpu_interrupt(env, CPU_INTERRUPT_HARD);
+ break;
+ }
+ }
+ } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
+ env->interrupt_index = 0;
+ cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
+ }
+}
+
static void cpu_set_irq(void *opaque, int irq, int level)
{
CPUState *env = opaque;
if (level) {
DPRINTF("Raise CPU IRQ %d\n", irq);
-
env->halted = 0;
-
- if (env->interrupt_index == 0 ||
- ((env->interrupt_index & ~15) == TT_EXTINT &&
- (env->interrupt_index & 15) < irq)) {
- env->interrupt_index = TT_EXTINT | irq;
- cpu_interrupt(env, CPU_INTERRUPT_HARD);
- } else {
- DPRINTF("Not triggered, pending exception %d\n",
- env->interrupt_index);
- }
+ env->pil_in |= 1 << irq;
+ cpu_check_irqs(env);
} else {
DPRINTF("Lower CPU IRQ %d\n", irq);
+ env->pil_in &= ~(1 << irq);
+ cpu_check_irqs(env);
}
}