Revision d532b26c hw/sun4u.c
b/hw/sun4u.c | ||
---|---|---|
232 | 232 |
|
233 | 233 |
void cpu_check_irqs(CPUState *env) |
234 | 234 |
{ |
235 |
uint32_t pil = env->pil_in | (env->softint & ~SOFTINT_TIMER) | |
|
236 |
((env->softint & SOFTINT_TIMER) << 14); |
|
235 |
uint32_t pil = env->pil_in | |
|
236 |
(env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER)); |
|
237 |
|
|
238 |
/* check if TM or SM in SOFTINT are set |
|
239 |
setting these also causes interrupt 14 */ |
|
240 |
if (env->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) { |
|
241 |
pil |= 1 << 14; |
|
242 |
} |
|
243 |
|
|
244 |
if (!pil) { |
|
245 |
if (env->interrupt_request & CPU_INTERRUPT_HARD) { |
|
246 |
CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n", |
|
247 |
env->interrupt_index); |
|
248 |
env->interrupt_index = 0; |
|
249 |
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); |
|
250 |
} |
|
251 |
return; |
|
252 |
} |
|
253 |
|
|
254 |
if (cpu_interrupts_enabled(env)) { |
|
237 | 255 |
|
238 |
if (pil && (env->interrupt_index == 0 || |
|
239 |
(env->interrupt_index & ~15) == TT_EXTINT)) { |
|
240 | 256 |
unsigned int i; |
241 | 257 |
|
242 |
for (i = 15; i > 0; i--) {
|
|
258 |
for (i = 15; i > env->psrpil; i--) {
|
|
243 | 259 |
if (pil & (1 << i)) { |
244 | 260 |
int old_interrupt = env->interrupt_index; |
245 |
|
|
246 |
env->interrupt_index = TT_EXTINT | i; |
|
247 |
if (old_interrupt != env->interrupt_index) { |
|
248 |
CPUIRQ_DPRINTF("Set CPU IRQ %d\n", i); |
|
261 |
int new_interrupt = TT_EXTINT | i; |
|
262 |
|
|
263 |
if (env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt) { |
|
264 |
CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d " |
|
265 |
"current %x >= pending %x\n", |
|
266 |
env->tl, cpu_tsptr(env)->tt, new_interrupt); |
|
267 |
} else if (old_interrupt != new_interrupt) { |
|
268 |
env->interrupt_index = new_interrupt; |
|
269 |
CPUIRQ_DPRINTF("Set CPU IRQ %d old=%x new=%x\n", i, |
|
270 |
old_interrupt, new_interrupt); |
|
249 | 271 |
cpu_interrupt(env, CPU_INTERRUPT_HARD); |
250 | 272 |
} |
251 | 273 |
break; |
252 | 274 |
} |
253 | 275 |
} |
254 |
} else if (!pil && (env->interrupt_index & ~15) == TT_EXTINT) {
|
|
255 |
CPUIRQ_DPRINTF("Reset CPU IRQ %d\n", env->interrupt_index & 15);
|
|
256 |
env->interrupt_index = 0;
|
|
257 |
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
|
276 |
} else { |
|
277 |
CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x "
|
|
278 |
"current interrupt %x\n",
|
|
279 |
pil, env->pil_in, env->softint, env->interrupt_index);
|
|
258 | 280 |
} |
259 | 281 |
} |
260 | 282 |
|
Also available in: Unified diff