PERFORCE change 135044 for review
Warner Losh
imp at FreeBSD.org
Fri Feb 8 09:39:46 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=135044
Change 135044 by imp at 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':
More information about the p4-projects
mailing list