From 4aee1921206ddc8fc1e89ab03c4fd26b8520e971 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 11 Jun 1996 10:07:14 +0000 Subject: delete intr_freevec(), add intr_findvec() [more flexible interface] --- sys/arch/mvme68k/mvme68k/trap.c | 40 +++++++++++++++++++++------------------- 1 file 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 @@ -1147,6 +1147,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 @@ -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 #include -- cgit v1.2.3