Subject: console polling interrupts?
To: None <tech-kern@netbsd.org>
From: Jaromír <jdolecek@netbsd.org>
List: tech-kern
Date: 06/16/2001 15:23:13
Hi,
I'd like to change the console polling interface requirement in that
cnpollc(9) and hence cngetc(9) would always need to be called on splhigh().
The idea here is that if we are polling, we don't want any interrupts
to happen. I'm including the diff to do so. This seems like a better
solution that I posted previously.

Opinions?

Jaromir

Index: cons.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/cons.c,v
retrieving revision 1.40
diff -u -p -r1.40 cons.c
--- cons.c	2001/06/04 09:45:03	1.40
+++ cons.c	2001/06/16 13:18:12
@@ -253,8 +253,9 @@ cngetsn(cp, size)
 	int size;
 {
 	char *lp;
-	int c, len;
+	int c, len, s;
 
+	s = splhigh();
 	cnpollc(1);
 
 	lp = cp;
@@ -267,6 +268,7 @@ cngetsn(cp, size)
 			printf("\n");
 			*lp++ = '\0';
 			cnpollc(0);
+			splx(s);
 			return (len);
 		case '\b':
 		case '\177':
Index: isa/fd.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/isa/fd.c,v
retrieving revision 1.17
diff -u -p -r1.17 fd.c
--- isa/fd.c	2001/06/07 16:48:09	1.17
+++ isa/fd.c	2001/06/16 13:18:12
@@ -1591,9 +1591,10 @@ void
 fd_mountroot_hook(dev)
 	struct device *dev;
 {
-	int c;
+	int c, s;
 
 	printf("Insert filesystem floppy and press return.");
+	s = splhigh();
 	cnpollc(1);
 	for (;;) {
 		c = cngetc();
@@ -1603,4 +1604,5 @@ fd_mountroot_hook(dev)
 		}
 	}
 	cnpollc(0);
+	splx(s);
 }
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!