diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-04-16 23:36:49 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-04-16 23:36:49 +0000 |
commit | aa6708dab2850d528554679d0e35dbed07dbaad9 (patch) | |
tree | 576949a7a9519e520399a8da0de51d4b3e1ffa6c /sys/arch/mvme88k | |
parent | 47c10013eb335a330ccef6bcdfa3b2e49bd3713a (diff) |
Bounds check PCC2 and SYSCON interrupt vectors.
Diffstat (limited to 'sys/arch/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/dev/pcctwo.c | 15 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/syscon.c | 13 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/sysconreg.h | 9 |
3 files changed, 22 insertions, 15 deletions
diff --git a/sys/arch/mvme88k/dev/pcctwo.c b/sys/arch/mvme88k/dev/pcctwo.c index c34a1ee7db6..30253fe3b1e 100644 --- a/sys/arch/mvme88k/dev/pcctwo.c +++ b/sys/arch/mvme88k/dev/pcctwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcctwo.c,v 1.22 2004/04/14 13:42:54 miod Exp $ */ +/* $OpenBSD: pcctwo.c,v 1.23 2004/04/16 23:36:48 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt * All rights reserved. @@ -25,7 +25,7 @@ */ /* - * VME18x PCC2 chip + * VME1x7 PCC2 chip */ #include <sys/param.h> #include <sys/conf.h> @@ -206,9 +206,10 @@ pcctwointr_establish(vec, ih) int vec; struct intrhand *ih; { - if (vec >= PCC2_NVEC) { - printf("pcctwo: illegal vector: 0x%x\n", vec); - panic("pcctwointr_establish"); - } - return (intr_establish(PCC2_VECBASE+vec, ih)); +#ifdef DIAGNOSTIC + if (vec < 0 || vec >= PCC2_NVEC) + panic("pcctwo_establish: illegal vector 0x%x\n", vec); +#endif + + return (intr_establish(PCC2_VECBASE + vec, ih)); } diff --git a/sys/arch/mvme88k/dev/syscon.c b/sys/arch/mvme88k/dev/syscon.c index 7ab3a24c9ca..680a6e19f17 100644 --- a/sys/arch/mvme88k/dev/syscon.c +++ b/sys/arch/mvme88k/dev/syscon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syscon.c,v 1.17 2004/04/14 23:27:11 miod Exp $ */ +/* $OpenBSD: syscon.c,v 1.18 2004/04/16 23:36:48 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. @@ -201,9 +201,9 @@ sysconattach(parent, self, args) sc->sc_m188ih.ih_wantframe = 1; sc->sc_m188ih.ih_ipl = IPL_ABORT; - intr_establish(SYSCV_ABRT, &sc->sc_abih); - intr_establish(SYSCV_ACF, &sc->sc_acih); - intr_establish(SYSCV_SYSF, &sc->sc_sfih); + sysconintr_establish(SYSCV_ABRT, &sc->sc_abih); + sysconintr_establish(SYSCV_ACF, &sc->sc_acih); + sysconintr_establish(SYSCV_SYSF, &sc->sc_sfih); intr_establish(M188_IVEC, &sc->sc_m188ih); config_search(syscon_scan, self, args); @@ -214,6 +214,11 @@ sysconintr_establish(vec, ih) int vec; struct intrhand *ih; { +#ifdef DIAGNOSTIC + if (vec < SYSCON_VECT || vec >= SYSCON_VECT + SYSCON_NVEC) + panic("sysconintr_establish: illegal vector 0x%x\n", vec); +#endif + return (intr_establish(vec, ih)); } diff --git a/sys/arch/mvme88k/dev/sysconreg.h b/sys/arch/mvme88k/dev/sysconreg.h index 816931b8ed4..e0b12f8d44e 100644 --- a/sys/arch/mvme88k/dev/sysconreg.h +++ b/sys/arch/mvme88k/dev/sysconreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysconreg.h,v 1.4 2003/10/11 22:08:57 miod Exp $ */ +/* $OpenBSD: sysconreg.h,v 1.5 2004/04/16 23:36:48 miod Exp $ */ /* * Memory map for SYSCON found in mvme188 board set. @@ -47,8 +47,11 @@ struct sysconreg { extern struct sysconreg *sys_syscon; /* - * Vectors we use + * Map syscon interrupts a la PCC2 */ +#define SYSCON_VECT 0x50 +#define SYSCON_NVEC 0x10 + #define SYSCV_ABRT 0x52 #define SYSCV_SYSF 0x53 #define SYSCV_ACF 0x54 @@ -57,5 +60,3 @@ extern struct sysconreg *sys_syscon; #define SYSCV_TIMER3 0x57 #define SYSCV_TIMER2 0x58 #define SYSCV_TIMER1 0x59 - - |