Subject: Another crash
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: None <Mark_Weaver@brown.edu>
List: current-users
Date: 08/09/1994 21:44:38
Well, the same thing just happened again, while compiling the
kernel.  The situation was exactly the same, except that instead
of reading man pages I was "write"ing messages to the other telnetted
person (who was writing to me also).

I'd also like to add some more info.  The last kernel I used was
supped on Aug 2nd, and I didn't have any such problems with that.
Also, nothing significant other than the code has changed in the
last several weeks.  The fstab, config, hardware configuration,
etc, has not been changed.

The two times it has crashed has been while compiling the Aug 9th
kernel with the Aug 7th kernel and userland.  Actually, I've got
a few Aug 9th userland executables (ipcrm, tar, and ld.so).  I'm
compiling my new kernel with a slightly different config, but I
saved a copy of my old one and that's what I posted in my last
message.

It seems I have at least a semi-reproducable problem here, so if
anyone has ideas, let me know.  Unfortunately my kernel source is
now the Aug 9th system, but I have diffs from Aug 2 to Aug 7 and
from Aug 7 to Aug 9.

I guess this is a bug that was introduced between the 2nd and the
7th, so here are my diffs between those two days.  For now I've
removed most of the diffs of files that are not in my kernel, and
diffs of files that are in arch/{non-i386}.

	Mark
--------------------------------------------------------------------
Email: Mark_Weaver@brown.edu           | Brown University
PGP Key: finger mhw@cs.brown.edu       | Dept of Computer Science


--- src/gnu/usr.bin/ld/i386/BACKUP/mdprologue.S	Sun Aug  7 17:24:32 1994
+++ src/gnu/usr.bin/ld/i386/mdprologue.S	Wed Aug  3 13:59:02 1994
@@ -27,7 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	$Id: mdprologue.S,v 1.3 1994/01/29 02:03:27 jtc Exp $
+ *	$Id: mdprologue.S,v 1.3.2.1 1994/08/03 17:00:12 cgd Exp $
  */
 
 /*
@@ -43,13 +43,10 @@
 /*
  *	_rtl(int version, struct crt_ldso *crtp)
  */
-#define FRAME	12			/* Size of stack frame */
-
 
 _rtl:					# crt0 calls us here
 	pushl	%ebp			# Allocate stack frame
 	movl	%esp, %ebp
-	subl	$FRAME, %esp
 	pushl	%ebx
 	call	1f			# PIC function prologue
 1:
@@ -68,7 +65,7 @@
 	call	%eax			# _rtld(version, crtp, DYNAMIC)
 	addl	$12,%esp		# pop arguments
 
-	movl	(-FRAME-4)(%ebp), %ebx	# restore %ebx
+	movl	-4(%ebp), %ebx		# restore %ebx
 	leave				# remove stack frame,
 	ret				# let's rock
 
--- src/sys/arch/i386/i386/BACKUP/locore.s	Sun Aug  7 17:28:57 1994
+++ src/sys/arch/i386/i386/locore.s	Thu Aug  4 07:11:33 1994
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)locore.s	7.3 (Berkeley) 5/13/91
- *	$Id: locore.s,v 1.77 1994/07/04 23:20:44 mycroft Exp $
+ *	$Id: locore.s,v 1.77.2.2 1994/08/03 23:38:23 mycroft Exp $
  */
 
 /*
@@ -243,46 +243,57 @@
 	movl	$0x69727943,_cpu_vendor-KERNBASE	# store vendor string
 	movw	$0x0078,_cpu_vendor-KERNBASE+4
 
-	/* Set cache parameters */
-	invd				# Start with guaranteed clean cache
-	movb	$0xc0,%al		# Configuration Register index (CCR0)
+#ifndef notdef
+	/* Disable caching of the ISA hole only. */
+	invd
+	movb	$CCR0,%al		# Configuration Register index (CCR0)
 	outb	%al,$0x22
-	# movb	$0x22,%al		# Configuration Register CCR0 data
-	movb	$0x02,%al		# Configuration Register CCR0 data
+	inb	$0x23,%al
+	orb	$CCR0_NC1,%al
 	outb	%al,$0x23
-	movb	$0xc1,%al		# CCR1
+	invd
+#else
+	/* Set cache parameters */
+	invd				# Start with guaranteed clean cache
+#ifdef CYRIX_CACHE_WORKS
+	movb	$CCR0,%al		# Configuration Register index (CCR0)
 	outb	%al,$0x22
-	xorb	%al,%al
+	inb	$0x23,%al
+	andb	$~CCR0_NC0,%al
+	orb	$CCR0_NC1,%al
 	outb	%al,$0x23
 	/* clear non-cacheable region 1	*/
-	movb	$0xc6,%al
+	movb	$(NCR1+2),%al
 	outb	%al,$0x22
-	xorb	%al,%al
+	movb	$NCR_SIZE_0K,%al
 	outb	%al,$0x23
 	/* clear non-cacheable region 2	*/
-	movb	$0xc9,%al
+	movb	$(NCR2+2),%al
 	outb	%al,$0x22
-	xorb	%al,%al
+	movb	$NCR_SIZE_0K,%al
 	outb	%al,$0x23
 	/* clear non-cacheable region 3	*/
-	movb	$0xcc,%al
+	movb	$(NCR3+2),%al
 	outb	%al,$0x22
-	xorb	%al,%al
+	movb	$NCR_SIZE_0K,%al
 	outb	%al,$0x23
 	/* clear non-cacheable region 4	*/
-	movb	$0xcf,%al
+	movb	$(NCR4+2),%al
 	outb	%al,$0x22
-	xorb	%al,%al
+	movb	$NCR_SIZE_0K,%al
 	outb	%al,$0x23
 	/* enable caching in CR0 */
 	movl	%cr0,%eax
-#ifdef notyet_cyrix
 	andl	$~(CR0_CD|CR0_NW),%eax
+	movl	%eax,%cr0
 #else
+	/* disable caching in CR0 */
+	movl	%cr0,%eax
 	orl	$CR0_CD,%eax
-	invd
-#endif
 	movl	%eax,%cr0
+#endif
+	invd
+#endif /* notdef */
 
 	jmp	2f
 
@@ -530,7 +541,7 @@
 	movl	__udatasel,%ecx
 	pushl	%ecx			# user ss
 	pushl	$0xdeadbeef		# user esp (set by execve)
-	pushl	$(PSL_USERSET | PSL_IOPL)	# user eflags
+	pushl	$PSL_USERSET		# user eflags
 	pushl	%eax			# user cs
 	pushl	$0xdeadbeef		# user eip (set by execve)
 	subl	$40,%esp		# error code, trap number, registers
@@ -559,16 +570,20 @@
 1:
 #endif
 
-#ifndef notyet_cyrix
+#ifdef notdef
 	cmp	$CPU_486DLC,_cpu
 	jne	1f
 	pushl	$2f
 	call	_printf
 	addl	$4,%esp
 	jmp	1f
-2:	.asciz	"WARNING: CYRIX 486DLC DETECTED; CACHE DISABLED.\n"
-1:
+#ifdef CYRIX_CACHE_WORKS
+2:	.asciz	"WARNING: CYRIX 486DLC CACHE ENABLED.\n"
+#else
+2:	.asciz	"WARNING: CYRIX 486DLC CACHE DISABLED BY DEFAULT.\n"
 #endif
+1:
+#endif /* notdef */
 
 	INTRFASTEXIT
 	/* NOTREACHED */
--- src/sys/arch/i386/include/BACKUP/specialreg.h	Sun Aug  7 17:29:15 1994
+++ src/sys/arch/i386/include/specialreg.h	Thu Aug  4 07:11:38 1994
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)specialreg.h	7.1 (Berkeley) 5/9/91
- *	$Id: specialreg.h,v 1.5 1994/05/24 11:54:24 mycroft Exp $
+ *	$Id: specialreg.h,v 1.5.2.1 1994/08/03 23:36:36 mycroft Exp $
  */
 
 /*
@@ -52,3 +52,54 @@
 #define CR0_AM	0x00040000	/* Alignment Mask (set to enable AC flag) */
 #define	CR0_NW	0x20000000	/* Not Write-through */
 #define	CR0_CD	0x40000000	/* Cache Disable */
+
+/*
+ * Cyrix 486 DLC special registers, accessable as IO ports.
+ */
+#define CCR0	0xc0		/* configuration control register 0 */
+#define CCR0_NC0	0x01	/* first 64K of each 1M memory region is non-cacheable */
+#define CCR0_NC1	0x02	/* 640K-1M region is non-cacheable */
+#define CCR0_A20M	0x04	/* enables A20M# input pin */
+#define CCR0_KEN	0x08	/* enables KEN# input pin */
+#define CCR0_FLUSH	0x10	/* enables FLUSH# input pin */
+#define CCR0_BARB	0x20	/* flushes internal cache when entering hold state */
+#define CCR0_CO		0x40	/* cache org: 1=direct mapped, 0=2x set assoc */
+#define CCR0_SUSPEND	0x80	/* enables SUSP# and SUSPA# pins */
+
+#define CCR1	0xc1		/* configuration control register 1 */
+#define CCR1_RPL	0x01	/* enables RPLSET and RPLVAL# pins */
+/* the remaining 7 bits of this register are reserved */
+
+/*
+ * the following four 3-byte registers control the non-cacheable regions.
+ * These registers must be written as three seperate bytes.
+ *
+ * NCRx+0: A31-A24 of starting address
+ * NCRx+1: A23-A16 of starting address
+ * NCRx+2: A15-A12 of starting address | NCR_SIZE_xx.
+ * 
+ * The non-cacheable region's starting address must be aligned to the
+ * size indicated by the NCR_SIZE_xx field.
+ */
+#define NCR1	0xc4
+#define NCR2	0xc7
+#define NCR3	0xca
+#define NCR4	0xcd
+
+#define NCR_SIZE_0K	0
+#define NCR_SIZE_4K	1
+#define NCR_SIZE_8K	2
+#define NCR_SIZE_16K	3
+#define NCR_SIZE_32K	4
+#define NCR_SIZE_64K	5
+#define NCR_SIZE_128K	6
+#define NCR_SIZE_256K	7
+#define NCR_SIZE_512K	8
+#define NCR_SIZE_1M	9
+#define NCR_SIZE_2M	10
+#define NCR_SIZE_4M	11
+#define NCR_SIZE_8M	12
+#define NCR_SIZE_16M	13
+#define NCR_SIZE_32M	14
+#define NCR_SIZE_4G	15
+
--- src/sys/arch/i386/isa/BACKUP/ultra14f.c	Sun Aug  7 17:30:03 1994
+++ src/sys/arch/i386/isa/ultra14f.c	Wed Aug  3 15:22:07 1994
@@ -26,7 +26,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *      $Id: ultra14f.c,v 1.30.2.3 1994/08/01 17:13:53 cgd Exp $
+ *      $Id: ultra14f.c,v 1.30.2.4 1994/08/03 17:12:45 cgd Exp $
  */
 
 /*
@@ -606,7 +606,7 @@
 		ia->ia_drq = uha->uha_dma;
 
 	ia->ia_msize = 0;
-	ia->ia_iosize = 4;
+	ia->ia_iosize = 16;
 	return 1;
 }
 
--- src/sys/isofs/cd9660/BACKUP/TODO.hibler	Sun Aug  7 17:32:03 1994
+++ src/sys/isofs/cd9660/TODO.hibler	Wed Aug  3 15:25:12 1994
@@ -1,4 +1,4 @@
-#	$NetBSD: TODO.hibler,v 1.3.2.1 1994/07/20 03:17:39 cgd Exp $
+#	$NetBSD: TODO.hibler,v 1.3.2.2 1994/08/03 06:16:20 cgd Exp $
 
 1. Investiate making ISOFS another UFS shared filesystem (ala FFS/MFS/LFS).
    Since it was modelled after the inode code, we might be able to merge
@@ -13,5 +13,4 @@
    cluster).
 
 5. Seems like there should be a "notrans" or some such mount option to show
-   filenames as they really are without lower-casing, stripping of version
-   numbers, etc.  Does this make sense?
+   filenames as they really are without lower-casing.  Does this make sense?
--- src/sys/isofs/cd9660/BACKUP/cd9660_vnops.c	Sun Aug  7 17:32:04 1994
+++ src/sys/isofs/cd9660/cd9660_vnops.c	Wed Aug  3 15:25:13 1994
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vnops.c,v 1.5.2.3 1994/07/20 06:17:17 cgd Exp $	*/
+/*	$NetBSD: cd9660_vnops.c,v 1.5.2.4 1994/08/03 06:16:26 cgd Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -946,7 +946,7 @@
 		if (VTOI(ap->a_vp)->i_mnt->iso_ftype == ISO_FTYPE_RRIP)
 			*ap->a_retval = NAME_MAX;
 		else
-			*ap->a_retval = 23;	/* XXX 8.8;5 */
+			*ap->a_retval = 37;
 		return (0);
 	case _PC_PATH_MAX:
 		*ap->a_retval = PATH_MAX;
--- src/sys/kern/BACKUP/tty.c	Sun Aug  7 17:32:21 1994
+++ src/sys/kern/tty.c	Wed Aug  3 15:25:16 1994
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.49 1994/06/29 06:33:20 cgd Exp $	*/
+/*	$NetBSD: tty.c,v 1.49.2.1 1994/08/03 03:51:00 cgd Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -167,6 +167,9 @@
 	if (!ISSET(tp->t_state, TS_ISOPEN)) {
 		SET(tp->t_state, TS_ISOPEN);
 		bzero(&tp->t_winsize, sizeof(tp->t_winsize));
+#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
+		tp->t_flags = 0;
+#endif
 	}
 	CLR(tp->t_state, TS_WOPEN);
 	splx(s);
--- src/sys/kern/BACKUP/tty_compat.c	Sun Aug  7 17:32:48 1994
+++ src/sys/kern/tty_compat.c	Wed Aug  3 15:25:17 1994
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_compat.c,v 1.14 1994/06/29 06:33:24 cgd Exp $	*/
+/*	$NetBSD: tty_compat.c,v 1.14.2.1 1994/08/03 03:51:06 cgd Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -126,7 +126,7 @@
 			term.c_ospeed = compatspcodes[speed];
 		term.c_cc[VERASE] = sg->sg_erase;
 		term.c_cc[VKILL] = sg->sg_kill;
-		tp->t_flags = tp->t_flags&0xffff0000 | sg->sg_flags&0xffff;
+		tp->t_flags = (ttcompatgetflags(tp)&0xffff0000) | (sg->sg_flags&0xffff);
 		ttcompatsetflags(tp, &term);
 		return (ttioctl(tp, com == TIOCSETP ? TIOCSETAF : TIOCSETA, 
 			&term, flag, p));
@@ -186,17 +186,20 @@
 	case TIOCLBIC:
 	case TIOCLSET: {
 		struct termios term;
+		long flags;
 
 		term = tp->t_termios;
-		if (com == TIOCLSET)
-			tp->t_flags = (tp->t_flags&0xffff) | *(int *)data<<16;
-		else {
-			tp->t_flags = 
-			 (ttcompatgetflags(tp)&0xffff0000)|(tp->t_flags&0xffff);
-			if (com == TIOCLBIS)
-				tp->t_flags |= *(int *)data<<16;
-			else
-				tp->t_flags &= ~(*(int *)data<<16);
+		flags = ttcompatgetflags(tp);
+		switch (com) {
+		case TIOCLSET:
+			tp->t_flags = (flags&0xffff) | (*(int *)data<<16);
+			break;
+		case TIOCLBIS:
+			tp->t_flags = flags | (*(int *)data<<16);
+			break;
+		case TIOCLBIC:
+			tp->t_flags = flags & ~(*(int *)data<<16);
+			break;
 		}
 		ttcompatsetlflags(tp, &term);
 		return (ttioctl(tp, TIOCSETA, &term, flag, p));
@@ -242,49 +245,49 @@
 	register long cflag = tp->t_cflag;
 	register flags = 0;
 
-	if (iflag&IXOFF)
+	if (iflag & IXOFF)
 		flags |= TANDEM;
-	if (iflag&ICRNL || oflag&ONLCR)
+	if (iflag & ICRNL || oflag & ONLCR)
 		flags |= CRMOD;
-	if (cflag&PARENB) {
-		if (iflag&INPCK) {
-			if (cflag&PARODD)
+	if (cflag & PARENB) {
+		if (iflag & INPCK) {
+			if (cflag & PARODD)
 				flags |= ODDP;
 			else
 				flags |= EVENP;
 		} else
 			flags |= EVENP | ODDP;
 	} else {
-		if ((tp->t_flags&LITOUT) && !(oflag&OPOST))
+		if ((tp->t_flags & LITOUT) && !(oflag & OPOST))
 			flags |= LITOUT;
-		if (tp->t_flags&PASS8)
+		if (tp->t_flags & PASS8)
 			flags |= PASS8;
 	}
 	
-	if ((lflag&ICANON) == 0) {	
+	if ((lflag & ICANON) == 0) {	
 		/* fudge */
 		if (iflag&IXON || lflag&ISIG || lflag&IEXTEN || cflag&PARENB)
 			flags |= CBREAK;
 		else
 			flags |= RAW;
 	}
-	if (cflag&MDMBUF)
+	if (cflag & MDMBUF)
 		flags |= MDMBUF;
-	if ((cflag&HUPCL) == 0)
+	if ((cflag & HUPCL) == 0)
 		flags |= NOHANG;
-	if (oflag&OXTABS)
+	if (oflag & OXTABS)
 		flags |= XTABS;
-	if (lflag&ECHOE)
+	if (lflag & ECHOE)
 		flags |= CRTERA|CRTBS;
-	if (lflag&ECHOKE)
+	if (lflag & ECHOKE)
 		flags |= CRTKIL|CRTBS;
-	if (lflag&ECHOPRT)
+	if (lflag & ECHOPRT)
 		flags |= PRTERA;
-	if (lflag&ECHOCTL)
+	if (lflag & ECHOCTL)
 		flags |= CTLECH;
-	if ((iflag&IXANY) == 0)
+	if ((iflag & IXANY) == 0)
 		flags |= DECCTQ;
-	flags |= lflag&(ECHO|TOSTOP|FLUSHO|PENDIN|NOFLSH);
+	flags |= lflag & (ECHO|TOSTOP|FLUSHO|PENDIN|NOFLSH);
 	if (ttydebug)
 		printf("getflags: %x\n", flags);
 	return (flags);
@@ -300,61 +303,71 @@
 	register long lflag = t->c_lflag;
 	register long cflag = t->c_cflag;
 
+	if (flags & TANDEM)
+		iflag |= IXOFF;
+	else
+		iflag &= ~IXOFF;
+	if (flags & ECHO)
+		lflag |= ECHO;
+	else
+		lflag &= ~ECHO;
+	if (flags & CRMOD) {
+		iflag |= ICRNL;
+		oflag |= ONLCR;
+	} else {
+		iflag &= ~ICRNL;
+		oflag &= ~ONLCR;
+	}
+	if (flags & XTABS)
+		oflag |= OXTABS;
+	else
+		oflag &= ~OXTABS;
+
+
 	if (flags & RAW) {
 		iflag &= IXOFF;
-		oflag &= ~OPOST;
-		lflag &= ~(ECHOCTL|ISIG|ICANON|IEXTEN);
+		lflag &= ~(ISIG|ICANON|IEXTEN);
 	} else {
 		iflag |= BRKINT|IXON|IMAXBEL;
-		oflag |= OPOST;
-		lflag |= ISIG|IEXTEN|ECHOCTL;	/* XXX was echoctl on ? */
-		if (flags & XTABS)
-			oflag |= OXTABS;
-		else
-			oflag &= ~OXTABS;
+		lflag |= ISIG|IEXTEN;
 		if (flags & CBREAK)
 			lflag &= ~ICANON;
 		else
 			lflag |= ICANON;
-		if (flags&CRMOD) {
-			iflag |= ICRNL;
-			oflag |= ONLCR;
-		} else {
-			iflag &= ~ICRNL;
-			oflag &= ~ONLCR;
-		}
 	}
-	if (flags&ECHO)
-		lflag |= ECHO;
-	else
-		lflag &= ~ECHO;
 		
-	if (flags&(RAW|LITOUT|PASS8)) {
+	switch (flags & ANYP) {
+	case EVENP:
+		iflag |= INPCK;
+		cflag &= ~PARODD;
+		break;
+	case ODDP:
+		iflag |= INPCK;
+		cflag |= PARODD;
+		break;
+	default:
+		iflag &= ~INPCK;
+		break;
+	}
+
+	if (flags & (RAW|LITOUT|PASS8)) {
 		cflag &= ~(CSIZE|PARENB);
 		cflag |= CS8;
-		if ((flags&(RAW|PASS8)) == 0)
+		if ((flags & (RAW|PASS8)) == 0)
 			iflag |= ISTRIP;
 		else
 			iflag &= ~ISTRIP;
+		if ((flags & (RAW|LITOUT)) == 0)
+			oflag |= OPOST;
+		else
+			oflag &= ~OPOST;
 	} else {
 		cflag &= ~CSIZE;
 		cflag |= CS7|PARENB;
 		iflag |= ISTRIP;
+		oflag |= OPOST;
 	}
-	if ((flags&(EVENP|ODDP)) == EVENP) {
-		iflag |= INPCK;
-		cflag &= ~PARODD;
-	} else if ((flags&(EVENP|ODDP)) == ODDP) {
-		iflag |= INPCK;
-		cflag |= PARODD;
-	} else 
-		iflag &= ~INPCK;
-	if (flags&LITOUT)
-		oflag &= ~OPOST;	/* move earlier ? */
-	if (flags&TANDEM)
-		iflag |= IXOFF;
-	else
-		iflag &= ~IXOFF;
+
 	t->c_iflag = iflag;
 	t->c_oflag = oflag;
 	t->c_lflag = lflag;
@@ -371,49 +384,57 @@
 	register long lflag = t->c_lflag;
 	register long cflag = t->c_cflag;
 
-	if (flags&CRTERA)
+	/* Nothing we can do with CRTBS. */
+	if (flags & PRTERA)
+		lflag |= ECHOPRT;
+	else
+		lflag &= ~ECHOPRT;
+	if (flags & CRTERA)
 		lflag |= ECHOE;
 	else
 		lflag &= ~ECHOE;
-	if (flags&CRTKIL)
+	/* Nothing we can do with TILDE. */
+	if (flags & MDMBUF)
+		cflag |= MDMBUF;
+	else
+		cflag &= ~MDMBUF;
+	if (flags & NOHANG)
+		cflag &= ~HUPCL;
+	else
+		cflag |= HUPCL;
+	if (flags & CRTKIL)
 		lflag |= ECHOKE;
 	else
 		lflag &= ~ECHOKE;
-	if (flags&PRTERA)
-		lflag |= ECHOPRT;
-	else
-		lflag &= ~ECHOPRT;
-	if (flags&CTLECH)
+	if (flags & CTLECH)
 		lflag |= ECHOCTL;
 	else
 		lflag &= ~ECHOCTL;
-	if ((flags&DECCTQ) == 0)
+	if ((flags & DECCTQ) == 0)
 		iflag |= IXANY;
 	else
 		iflag &= ~IXANY;
-	if (flags & MDMBUF)
-		cflag |= MDMBUF;
-	else
-		cflag &= ~MDMBUF;
-	if (flags&NOHANG)
-		cflag &= ~HUPCL;
-	else
-		cflag |= HUPCL;
 	lflag &= ~(TOSTOP|FLUSHO|PENDIN|NOFLSH);
 	lflag |= flags&(TOSTOP|FLUSHO|PENDIN|NOFLSH);
-	if (flags&(LITOUT|PASS8)) {
-		iflag &= ~ISTRIP;
+
+	if (flags & (RAW|LITOUT|PASS8)) {
 		cflag &= ~(CSIZE|PARENB);
 		cflag |= CS8;
-		if (flags&LITOUT)
-			oflag &= ~OPOST;
-		if ((flags&(PASS8|RAW)) == 0)
+		if ((flags & (RAW|PASS8)) == 0)
 			iflag |= ISTRIP;
-	} else if ((flags&RAW) == 0) {
+		else
+			iflag &= ~ISTRIP;
+		if ((flags & (RAW|LITOUT)) == 0)
+			oflag |= OPOST;
+		else
+			oflag &= ~OPOST;
+	} else {
 		cflag &= ~CSIZE;
 		cflag |= CS7|PARENB;
+		iflag |= ISTRIP;
 		oflag |= OPOST;
 	}
+
 	t->c_iflag = iflag;
 	t->c_oflag = oflag;
 	t->c_lflag = lflag;
--- src/sys/msdosfs/BACKUP/msdosfs_fat.c	Sun Aug  7 17:33:29 1994
+++ src/sys/msdosfs/msdosfs_fat.c	Sun Aug  7 06:36:50 1994
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_fat.c,v 1.7.2.2 1994/07/19 17:06:45 cgd Exp $	*/
+/*	$NetBSD: msdosfs_fat.c,v 1.7.2.3 1994/08/04 19:15:13 mycroft Exp $	*/
 
 /*-
  * Copyright (C) 1994 Wolfgang Solfrank.
@@ -664,7 +664,7 @@
 	u_long *got;
 {
 	int error;
-	u_long idx, max_idx;
+	u_long idx;
 	u_long len, newst, foundcn, foundl, cn, l;
 	u_int map;
 	
@@ -692,11 +692,10 @@
 	foundcn = newst = (start * 1103515245 + 12345) % (pmp->pm_maxcluster - 1);
 	foundl = 0;
 	
-	max_idx = (pmp->pm_maxcluster - 1) / N_INUSEBITS;
-	idx = newst / N_INUSEBITS;
-	map = pmp->pm_inusemap[idx];
-	map |= (1 << (newst % N_INUSEBITS)) - 1;
-	while (1) {
+	for (cn = newst; cn <= pmp->pm_maxcluster;) {
+		idx = cn / N_INUSEBITS;
+		map = pmp->pm_inusemap[idx];
+		map |= (1 << (cn % N_INUSEBITS)) - 1;
 		if (map != (u_int)-1) {
 			cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
 			if ((l = chainlength(pmp, cn, count)) >= count)
@@ -706,19 +705,14 @@
 				foundl = l;
 			}
 			cn += l + 1;
-			if (cn > pmp->pm_maxcluster)
-				break;
-			idx = cn / N_INUSEBITS;
-			map = pmp->pm_inusemap[idx];
-			map |= (1 << (cn % N_INUSEBITS)) - 1;
 			continue;
 		}
-		if (++idx > max_idx)
-			break;
-		map = pmp->pm_inusemap[idx];
+		cn += N_INUSEBITS - cn % N_INUSEBITS;
 	}
-	for (idx = 0;;) {
+	for (cn = 0; cn < newst;) {
+		idx = cn / N_INUSEBITS;
 		map = pmp->pm_inusemap[idx];
+		map |= (1 << (cn % N_INUSEBITS)) - 1;
 		if (map != (u_int)-1) {
 			cn = idx * N_INUSEBITS + ffs(map^(u_int)-1) - 1;
 			if ((l = chainlength(pmp, cn, count)) >= count)
@@ -728,15 +722,9 @@
 				foundl = l;
 			}
 			cn += l + 1;
-			if (cn >= newst)
-				break;
-			idx = cn / N_INUSEBITS;
-			map = pmp->pm_inusemap[idx];
-			map |= (1 << (cn % N_INUSEBITS)) - 1;
 			continue;
 		}
-		if (++idx * N_INUSEBITS >= newst)
-			break;
+		cn += N_INUSEBITS - cn % N_INUSEBITS;
 	}
 
 	if (!foundl)
--- src/usr.sbin/config/BACKUP/mkioconf.c	Sun Aug  7 17:34:20 1994
+++ src/usr.sbin/config/mkioconf.c	Wed Aug  3 15:32:17 1994
@@ -33,7 +33,7 @@
 
 #ifndef lint
 /*static char sccsid[] = "from: @(#)mkioconf.c	5.18 (Berkeley) 5/10/91";*/
-static char rcsid[] = "$Id: mkioconf.c,v 1.32 1994/06/24 14:22:08 hpeyerl Exp $";
+static char rcsid[] = "$Id: mkioconf.c,v 1.32.2.1 1994/08/03 13:26:45 hpeyerl Exp $";
 #endif /* not lint */
 
 #include <stdio.h>
@@ -135,7 +135,7 @@
 		fprintf(fp, "\t%d,\t%d,\t%d,\t%d,\t{",
 			dp->d_unit, dp->d_pri < 0 ? 0 : dp->d_pri,
 			dp->d_flags, 1);
-		for (fl = fl->f_next; fl->f_type == COMPSPEC && fl->f_next; fl = fl->f_next)
+		for (fl = fl->f_next; fl->f_type == COMPSPEC && fl; fl = fl->f_next)
 			fprintf(fp, " 0x%x,", fl->f_compdev);
 		fprintf(fp, " NODEV },\n");
 	}

------------------------------------------------------------------------------