diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-11 10:07:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-06-11 10:07:14 +0000 |
commit | 4aee1921206ddc8fc1e89ab03c4fd26b8520e971 (patch) | |
tree | 4bce2c901965f9f809fe3bd792fcf660d349ded0 | |
parent | 1a245a5933733a1f0abf61b7969a91f764167c1a (diff) |
delete intr_freevec(), add intr_findvec() [more flexible interface]
-rw-r--r-- | sys/arch/mvme68k/mvme68k/trap.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 6dd9c3ef450..fb4bde04d11 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.6 1996/04/28 10:59:15 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.7 1996/06/11 10:07:13 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -1148,6 +1148,26 @@ hardintr(pc, evec, frame) #endif /* !INTR_ASM */ /* + * find a useable interrupt vector in the range start, end. It starts at + * the end of the range, and searches backwards (to increase the chances + * of not conflicting with more normal users) + */ +int +intr_findvec(start, end) + int start, end; +{ + extern u_long *vectab[], hardtrap, badtrap; + int vec; + + if (start < 0 || end > 255 || start > end) + return (-1); + for (vec = end; vec > start; --vec) + if (vectab[vec] == &badtrap || vectab[vec] == &hardtrap) + return (vec); + return (-1); +} + +/* * Chain the interrupt handler in. But first check if the vector * offset chosen is legal. It either must be a badtrap (not allocated * for a `system' purpose), or it must be a hardtrap (ie. already @@ -1179,24 +1199,6 @@ intr_establish(vec, ih) return (0); } -/* - * find a useable vector for devices that don't specify one - */ -int -intr_freevec() -{ - extern u_long *vectab[], hardtrap, badtrap; - int i; - - for (i = 255; i; --i) - if (vectab[i] == &badtrap) - return (i); - for (i = 255; i; --i) - if (vectab[i] == &hardtrap) - return (i); - return (-1); -} - #ifdef DDB #include <sys/reboot.h> #include <machine/db_machdep.h> |