Fix spl(9) botch in cpu_intr() on arc:

Don't enable unhandled interrupts before all interrupts are processed,
and also change all interrupt handlers to return processed MIPS_INT_MASK
values, rather than masked values of them.
This commit is contained in:
tsutsui 2008-03-14 16:43:27 +00:00
parent 868048cf4d
commit 4f59bf75cb
6 changed files with 25 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: c_magnum.c,v 1.18 2007/12/03 15:33:12 ad Exp $ */
/* $NetBSD: c_magnum.c,v 1.19 2008/03/14 16:43:27 tsutsui Exp $ */
/* $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $ */
/*
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.18 2007/12/03 15:33:12 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: c_magnum.c,v 1.19 2008/03/14 16:43:27 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -152,7 +152,7 @@ timer_magnum_intr(uint32_t mask, struct clockframe *cf)
hardclock(cf);
timer_jazzio_ev.ev_count++;
return ~MIPS_INT_MASK_4; /* Keep clock interrupts enabled */
return MIPS_INT_MASK_4; /* Keep clock interrupts enabled */
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: c_nec_jazz.c,v 1.12 2006/06/24 03:50:38 tsutsui Exp $ */
/* $NetBSD: c_nec_jazz.c,v 1.13 2008/03/14 16:43:27 tsutsui Exp $ */
/*-
* Copyright (C) 2000 Shuichiro URATA. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: c_nec_jazz.c,v 1.12 2006/06/24 03:50:38 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: c_nec_jazz.c,v 1.13 2008/03/14 16:43:27 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -72,7 +72,7 @@ timer_nec_jazz_intr(uint32_t mask, struct clockframe *cf)
hardclock(cf);
timer_jazzio_ev.ev_count++;
return ~MIPS_INT_MASK_3; /* Keep clock interrupts enabled */
return MIPS_INT_MASK_3; /* Keep clock interrupts enabled */
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: interrupt.c,v 1.3 2007/12/03 15:33:13 ad Exp $ */
/* $NetBSD: interrupt.c,v 1.4 2008/03/14 16:43:27 tsutsui Exp $ */
/* $OpenBSD: trap.c,v 1.22 1999/05/24 23:08:59 jason Exp $ */
/*
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.3 2007/12/03 15:33:13 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.4 2008/03/14 16:43:27 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -143,8 +143,10 @@ cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
struct clockframe cf;
struct cpu_inttab *inttab;
struct cpu_info *ci;
uint32_t handled;
u_int i;
handled = 0;
ci = curcpu();
uvmexp.intrs++;
ci->ci_idepth++;
@ -165,9 +167,9 @@ cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
*/
mips3_cp0_compare_write(0);
#endif
cause &= ~MIPS_INT_MASK_5;
handled |= MIPS_INT_MASK_5;
}
_splset((status & MIPS_INT_MASK_5) | MIPS_SR_INT_IE);
_splset((status & handled) | MIPS_SR_INT_IE);
/*
* If there is an independent timer interrupt handler, call it first.
@ -175,9 +177,9 @@ cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
*/
inttab = &cpu_int_tab[ARC_INTPRI_TIMER_INT];
if (inttab->int_mask & ipending) {
cause &= (*inttab->int_hand)(ipending, &cf);
handled |= (*inttab->int_hand)(ipending, &cf);
}
_splset((status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
_splset((status & handled) | MIPS_SR_INT_IE);
inttab++;
@ -187,10 +189,11 @@ cpu_intr(uint32_t status, uint32_t cause, uint32_t pc, uint32_t ipending)
*/
for (i = ARC_INTPRI_TIMER_INT + 1; i < ARC_NINTPRI; i++) {
if (inttab->int_mask & ipending) {
cause &= (*inttab->int_hand)(ipending, &cf);
handled |= (*inttab->int_hand)(ipending, &cf);
}
inttab++;
}
cause &= ~handled;
_splset((status & ~cause & MIPS_HARD_INT_MASK) | MIPS_SR_INT_IE);
ci->ci_idepth--;

View File

@ -1,4 +1,4 @@
/* $NetBSD: isabus.c,v 1.41 2007/12/03 15:33:15 ad Exp $ */
/* $NetBSD: isabus.c,v 1.42 2008/03/14 16:43:27 tsutsui Exp $ */
/* $OpenBSD: isabus.c,v 1.15 1998/03/16 09:38:46 pefo Exp $ */
/* NetBSD: isa.c,v 1.33 1995/06/28 04:30:51 cgd Exp */
@ -120,7 +120,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isabus.c,v 1.41 2007/12/03 15:33:15 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: isabus.c,v 1.42 2008/03/14 16:43:27 tsutsui Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -447,7 +447,7 @@ isabr_iointr(uint32_t mask, struct clockframe *cf)
isa_outb(IO_ICU1 + PIC_OCW1, imen);
isa_outb(IO_ICU2 + PIC_OCW1, imen >> 8);
return ~MIPS_INT_MASK_2;
return MIPS_INT_MASK_2;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: jazzio.c,v 1.18 2006/06/25 16:46:15 tsutsui Exp $ */
/* $NetBSD: jazzio.c,v 1.19 2008/03/14 16:43:27 tsutsui Exp $ */
/* $OpenBSD: picabus.c,v 1.11 1999/01/11 05:11:10 millert Exp $ */
/* NetBSD: tc.c,v 1.2 1995/03/08 00:39:05 cgd Exp */
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: jazzio.c,v 1.18 2006/06/25 16:46:15 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: jazzio.c,v 1.19 2008/03/14 16:43:27 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -223,7 +223,7 @@ jazzio_intr(uint32_t mask, struct clockframe *cf)
(*jirp->ih_func)(jirp->ih_arg);
jirp->ih_evcnt.ev_count++;
}
return ~MIPS_INT_MASK_1;
return MIPS_INT_MASK_1;
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: necpb.c,v 1.29 2007/03/04 05:59:36 christos Exp $ */
/* $NetBSD: necpb.c,v 1.30 2008/03/14 16:43:27 tsutsui Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.29 2007/03/04 05:59:36 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: necpb.c,v 1.30 2008/03/14 16:43:27 tsutsui Exp $");
#include "opt_pci.h"
@ -506,7 +506,7 @@ necpb_intr(uint32_t mask, struct clockframe *cf)
#endif
}
return handled ? ~MIPS_INT_MASK_2 : ~0;
return handled ? MIPS_INT_MASK_2 : 0;
}
#ifdef PCI_NETBSD_CONFIGURE