Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Feb 2008 17:39:45 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 135044 for review
Message-ID:  <200802081739.m18HdjWd081909@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=135044

Change 135044 by imp@imp_lighthouse on 2008/02/08 17:38:50

	Big ugly hack: disable interrupts and reenable them inside of gets.
	The problem is that this is called with interrupts enabled, creating
	a race between the UART ISR and cngetc.  I'm unsure why the UART
	interrupts are enabled, but we're hitting it in the simulator,
	so use the big hammer for now.

Affected files ...

.. //depot/projects/mips2-jnpr/src/sys/libkern/gets.c#2 edit

Differences ...

==== //depot/projects/mips2-jnpr/src/sys/libkern/gets.c#2 (text+ko) ====

@@ -31,15 +31,18 @@
 #include <sys/param.h>
 #include <sys/cons.h>
 #include <sys/libkern.h>
+#include <machine/cpufunc.h>
 
 void
 gets(char *cp, size_t size, int visible)
 {
 	char *lp, *end;
 	int c;
+	register_t s;
 
 	lp = cp;
 	end = cp + size - 1;
+	s = intr_disable();
 	for (;;) {
 		c = cngetc() & 0177;
 		switch (c) {
@@ -47,6 +50,7 @@
 		case '\r':
 			printf("%c", c);
 			*lp = '\0';
+			intr_restore(s);
 			return;
 		case '\b':
 		case '\177':



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802081739.m18HdjWd081909>