ALPHA-pl15b

[ Message-ID: <2jaihl$21l@klaava.Helsinki.FI> ]

 - pl15b mainly fixes some small tty problems.
diff --git a/Makefile b/Makefile
index b15808f..47407f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 0.99
 PATCHLEVEL = 15
-ALPHA = a
+ALPHA = b
 
 all:	Version zImage
 
diff --git a/drivers/FPU-emu/errors.c b/drivers/FPU-emu/errors.c
index d34e5e9..99de4fa 100644
--- a/drivers/FPU-emu/errors.c
+++ b/drivers/FPU-emu/errors.c
@@ -235,7 +235,7 @@
 	      0x127  in poly_2xm1.c
 	      0x128  in fpu_entry.c
        0x2nn  in an *.S file:
-              0x201  in reg_u_add.S, reg_round.S
+              0x201  in reg_u_add.S
               0x202  in reg_u_div.S
               0x203  in reg_u_div.S
               0x204  in reg_u_div.S
@@ -250,11 +250,14 @@
 	      0x213  in wm_sqrt.S
 	      0x214  in wm_sqrt.S
 	      0x215  in wm_sqrt.S
-	      0x216  in reg_round.S
-	      0x217  in reg_round.S
-	      0x218  in reg_round.S
 	      0x220  in reg_norm.S
 	      0x221  in reg_norm.S
+	      0x230  in reg_round.S
+	      0x231  in reg_round.S
+	      0x232  in reg_round.S
+	      0x233  in reg_round.S
+	      0x234  in reg_round.S
+	      0x235  in reg_round.S
  */
 
 void exception(int n)
diff --git a/drivers/FPU-emu/fpu_entry.c b/drivers/FPU-emu/fpu_entry.c
index 8b9a086..063f54f 100644
--- a/drivers/FPU-emu/fpu_entry.c
+++ b/drivers/FPU-emu/fpu_entry.c
@@ -577,10 +577,14 @@
 	case PREFIX_DS:   /* Redundant unless preceded by another override. */
 	  override->segment = PREFIX_DS;
 
+/* lock is not a valid prefix for FPU instructions,
+   let the cpu handle it to generate a SIGILL. */
+/*	case PREFIX_LOCK: */
+
 	  /* rep.. prefixes have no meaning for FPU instructions */
-	case PREFIX_LOCK:
 	case PREFIX_REPE:
 	case PREFIX_REPNE:
+
 	case OP_SIZE_PREFIX:  /* Used often by gcc, but has no effect. */
 	do_next_byte:
 	  FPU_EIP++;
@@ -600,6 +604,9 @@
 	    }
 	  else
 	    {
+	      /* Not a valid sequence of prefix bytes followed by
+		 an FPU instruction. */
+	      *Byte = byte;  /* Needed for error message. */
 	      FPU_EIP = ip;
 	      return 0;
 	    }
diff --git a/drivers/FPU-emu/reg_round.S b/drivers/FPU-emu/reg_round.S
index 32f2b2e..4209b22 100644
--- a/drivers/FPU-emu/reg_round.S
+++ b/drivers/FPU-emu/reg_round.S
@@ -157,7 +157,7 @@
 	je	LRound_To_24
 
 #ifdef PARANOID
-	jmp	L_bugged	/* There is no bug, just a bad control word */
+	jmp	L_bugged_denorm	/* There is no bug, just a bad control word */
 #endif PARANOID
 
 
@@ -178,7 +178,7 @@
 	je	LDown_24
 
 #ifdef PARANOID
-	jmp	L_bugged
+	jmp	L_bugged_round24
 #endif PARANOID
 
 LUp_24:
@@ -258,7 +258,7 @@
 	je	LDown_53
 
 #ifdef PARANOID
-	jmp	L_bugged
+	jmp	L_bugged_round53
 #endif PARANOID
 
 LUp_53:
@@ -332,7 +332,7 @@
 	je	LDown_64
 
 #ifdef PARANOID
-	jmp	L_bugged
+	jmp	L_bugged_round64
 #endif PARANOID
 
 LUp_64:
@@ -644,20 +644,38 @@
 
 #ifdef PARANOID
 /* If we ever get here then we have problems! */
-L_bugged:
-	pushl	EX_INTERNAL|0x201
+L_bugged_denorm:
+	pushl	EX_INTERNAL|0x230
+	call	EXCEPTION
+	popl	%ebx
+	jmp	L_exception_exit
+
+L_bugged_round24:
+	pushl	EX_INTERNAL|0x231
+	call	EXCEPTION
+	popl	%ebx
+	jmp	L_exception_exit
+
+L_bugged_round53:
+	pushl	EX_INTERNAL|0x232
+	call	EXCEPTION
+	popl	%ebx
+	jmp	L_exception_exit
+
+L_bugged_round64:
+	pushl	EX_INTERNAL|0x233
 	call	EXCEPTION
 	popl	%ebx
 	jmp	L_exception_exit
 
 L_norm_bugged:
-	pushl	EX_INTERNAL|0x216
+	pushl	EX_INTERNAL|0x234
 	call	EXCEPTION
 	popl	%ebx
 	jmp	L_exception_exit
 
 L_entry_bugged:
-	pushl	EX_INTERNAL|0x217
+	pushl	EX_INTERNAL|0x235
 	call	EXCEPTION
 	popl	%ebx
 L_exception_exit:
diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index 482afe6..5818e21 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -55,14 +55,11 @@
 {
 	unsigned long count, n;
 	struct tty_queue *fq, *tq;
-	int skip_readq;
 
 	if (from->stopped || EMPTY(&from->write_q))
 		return;
 	fq = &from->write_q;
-	/* Bypass the read_q if this is a pty master. */
-	skip_readq = IS_A_PTY_MASTER(to->line) && to->disc == N_TTY;
-	tq = skip_readq ? &to->secondary : &to->read_q;
+	tq = &to->read_q;
 	count = MIN(CHARS(fq), LEFT(tq));
 	while (count) {
 		n = MIN(MIN(TTY_BUF_SIZE - fq->tail, TTY_BUF_SIZE - tq->head),
@@ -72,10 +69,7 @@
 		fq->tail = (fq->tail + n) & (TTY_BUF_SIZE - 1);
 		tq->head = (tq->head + n) & (TTY_BUF_SIZE - 1);
 	}
-	if (skip_readq)
-		wake_up_interruptible(&to->secondary.proc_list);
-	else
-		TTY_READ_FLUSH(to);
+	TTY_READ_FLUSH(to);
 	if (LEFT(fq) > WAKEUP_CHARS)
 		wake_up_interruptible(&fq->proc_list);
 	if (from->write_data_cnt) {
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 2997601..c5731f7 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -954,6 +954,24 @@
 	int minimum, time;
 	int retval = 0;
 
+	/* Job control check -- must be done at start and after
+	   every sleep (POSIX.1 7.1.1.4). */
+	/* NOTE: not yet done after every sleep pending a thorough
+	   check of the logic of this change. -- jlc */
+	/* don't stop on /dev/console */
+	if (file->f_inode->i_rdev != CONSOLE_DEV &&
+	    current->tty == tty->line) {
+		if (tty->pgrp <= 0)
+			printk("read_chan: tty->pgrp <= 0!\n");
+		else if (current->pgrp != tty->pgrp) {
+			if (is_ignored(SIGTTIN) ||
+			    is_orphaned_pgrp(current->pgrp))
+				return -EIO;
+			kill_pg(current->pgrp, SIGTTIN, 1);
+			return -ERESTARTSYS;
+		}
+	}
+
 	if (L_ICANON(tty)) {
 		minimum = time = 0;
 		current->timeout = (unsigned long) -1;
@@ -974,24 +992,6 @@
 
 	add_wait_queue(&tty->secondary.proc_list, &wait);
 	while (1) {
-		/* Job control check -- must be done at start and after
-		   every sleep (POSIX.1 7.1.1.4). */
-		/* don't stop on /dev/console */
-		if (file->f_inode->i_rdev != CONSOLE_DEV &&
-		    current->tty == tty->line) {
-			if (tty->pgrp <= 0)
-				printk("read_chan: tty->pgrp <= 0!\n");
-			else if (current->pgrp != tty->pgrp) {
-				if (is_ignored(SIGTTIN) ||
-				    is_orphaned_pgrp(current->pgrp)) {
-					retval = -EIO;
-					break;
-				}
-				kill_pg(current->pgrp, SIGTTIN, 1);
-				retval = -ERESTARTSYS;
-				break;
-			}
-		}
 		/* First test for status change. */
 		if (tty->packet && tty->link->ctrl_status) {
 			if (b != buf)
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index b655989..b34778b 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -359,16 +359,15 @@
 
 	ext2_debug ("goal=%lu.\n", goal);
 
-	if (goal < es->s_first_data_block || goal >= es->s_blocks_count) {
-		ext2_warning (sb, "ext2_new_block",
-			      "Goal out of bounds: %lu", goal);
-		goal = es->s_first_data_block;
-	}
 repeat:
 	/*
 	 * First, test whether the goal block is free.
 	 */
 	i = ((goal - es->s_first_data_block) / EXT2_BLOCKS_PER_GROUP(sb));
+	if (i >= EXT2_BLOCKS_PER_GROUP(sb) || i < 0) {
+		i = 0;
+		goal = es->s_first_data_block;
+	}
 	gdp = get_group_desc (sb, i, &bh2);
 	if (gdp->bg_free_blocks_count > 0) {
 		j = ((goal - es->s_first_data_block) % EXT2_BLOCKS_PER_GROUP(sb));
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cac50aa..eaf22af 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -392,6 +392,7 @@
 extern void put_super(dev_t dev);
 extern dev_t ROOT_DEV;
 
+extern void show_buffers(void);
 extern void mount_root(void);
 
 extern int char_read(struct inode *, struct file *, char *, int);
diff --git a/kernel/traps.c b/kernel/traps.c
index 7321836..78ca139 100644
--- a/kernel/traps.c
+++ b/kernel/traps.c
@@ -89,8 +89,8 @@
 	printk("EIP:    %04x:%08lx\nEFLAGS: %08lx\n", 0xffff & regs->cs,regs->eip,regs->eflags);
 	printk("eax: %08lx   ebx: %08lx   ecx: %08lx   edx: %08lx\n",
 		regs->eax, regs->ebx, regs->ecx, regs->edx);
-	printk("esi: %08lx   edi: %08lx   ebp: %08lx\n",
-		regs->esi, regs->edi, regs->ebp);
+	printk("esi: %08lx   edi: %08lx   ebp: %08lx   esp: %08x\n",
+		regs->esi, regs->edi, regs->ebp, regs->esp);
 	printk("ds: %04x   es: %04x   fs: %04x   gs: %04x\n",
 		regs->ds, regs->es, regs->fs, regs->gs);
 	store_TR(i);
@@ -98,6 +98,9 @@
 	for(i=0;i<20;i++)
 		printk("%02x ",0xff & get_seg_byte(regs->cs,(i+(char *)regs->eip)));
 	printk("\n");
+	for(i=0;i<5;i++)
+		printk("%08x ", get_seg_long(regs->ss,(i+(unsigned long *)regs->esp)));
+	printk("\n");
 	do_exit(SIGSEGV);
 }