To: linux-m68k@lists.linux-m68k.org
Subject: L68K: 2.1.115
X-Yow: MERYL STREEP is my obstetrician!
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: 12 Aug 1998 09:38:43 +0200
Sender: owner-linux-m68k@phil.uni-sb.de

Hi!

Here are my changes for 2.1.115.  Sorry, but they will overlap with
patches send by Geert and others, but i could not check before.

- arch/m68k/config.in: Add UNIX98_PTYS config option.
- arch/m68k/kernel/entry.S, include/asm-m68k/unistd.h: Reserve streams1
  and streams2 syscalls, just in case.
- arch/m68k/mm/kmap.c: Fix kmap_sem locking.
- drivers/cdrom/cdrom.c: Avoid "defined but not used" warning.
- drivers/char/fbmem.c: Store only fb_var_idx in fb_info->node (which is
  not a kdev_t).
- drivers/video/fbcon.c: Some bug fixes from the vger tree.
- include/asm-m68k/spinlock.h: Make unused spinlocks real empty, if
  possible.
- include/asm-m68k/bitops.h: Define special bitmap functions only for
  kernel.
- fs/proc/array.c: Use TASK_UNMAPPED_BASE instead of SHM_RANGE_START.
- fs/ext2/truncate.c: Remove useless le32_zero.

The rest removes some gratuitous differences with the official kernel.

Andreas.

----------------------------------------------------------------------
--- linux-2.1/arch/m68k/config.in.~1~	Mon Aug 10 18:21:20 1998
+++ linux-2.1/arch/m68k/config.in	Mon Aug 10 20:40:26 1998
@@ -235,23 +235,11 @@
     tristate 'PAMsNet support' CONFIG_ATARI_PAMSNET
   fi
 fi
-endmenu
-
 fi
-fi
-
-source fs/Config.in
+endmenu
 
-if [ "$CONFIG_VME" = "n" ]; then
-  define_bool CONFIG_FB y
-  mainmenu_option next_comment
-  comment 'Console drivers'
-  source drivers/video/Config.in
-  endmenu
 fi
 
-source fs/nls/Config.in
-
 mainmenu_option next_comment
 comment 'Character devices'
  
@@ -266,6 +254,11 @@
   define_bool CONFIG_NVRAM y
 fi
 
+bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS
+if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
+	int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
+fi
+
 tristate 'Parallel printer support' CONFIG_M68K_PRINTER
 if [ "$CONFIG_ZORRO" = "y" ]; then
   dep_tristate 'Multiface Card III parallel support' CONFIG_MULTIFACE_III_LP $CONFIG_PRINTER
@@ -345,6 +338,18 @@
   bool 'Enhanced Real Time Clock Support' CONFIG_RTC
 fi
 endmenu
+
+source fs/Config.in
+
+if [ "$CONFIG_VME" = "n" ]; then
+  define_bool CONFIG_FB y
+  mainmenu_option next_comment
+  comment 'Console drivers'
+  source drivers/video/Config.in
+  endmenu
+fi
+
+source fs/nls/Config.in
 
 mainmenu_option next_comment
 comment 'Sound support'
--- linux-2.1/arch/m68k/kernel/entry.S.~1~	Mon Aug 10 18:21:23 1998
+++ linux-2.1/arch/m68k/kernel/entry.S	Sat Aug  8 00:46:44 1998
@@ -584,6 +584,8 @@
 	.long SYMBOL_NAME(sys_capset)           /* 185 */
 	.long SYMBOL_NAME(sys_sigaltstack)
 	.long SYMBOL_NAME(sys_sendfile)
+	.long SYMBOL_NAME(sys_ni_syscall)		/* streams1 */
+	.long SYMBOL_NAME(sys_ni_syscall)		/* streams2 */
 	.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
 		.long SYMBOL_NAME(sys_ni_syscall)
 	.endr
--- linux-2.1/arch/m68k/mm/kmap.c.~1~	Mon Aug 10 18:21:29 1998
+++ linux-2.1/arch/m68k/mm/kmap.c	Wed Jul 22 21:21:26 1998
@@ -277,8 +277,11 @@
 	size = (size + KMAP_STEP - 1) & ~(KMAP_STEP-1);
 	
 	down( &kmap_sem );
-	if (!(kmap = kmap_get_region( size, memavailp == NULL )))
-		return( 0 );
+	kmap = kmap_get_region(size, memavailp == NULL);
+	if (!kmap) {
+		up(&kmap_sem);
+		return 0;
+	}
 	from = kmap->addr;
 	retaddr += from;
 	kmap->mapaddr = retaddr;
--- linux-2.1/drivers/cdrom/cdrom.c.~1~	Mon Aug 10 18:23:33 1998
+++ linux-2.1/drivers/cdrom/cdrom.c	Tue Aug  4 01:37:23 1998
@@ -1081,10 +1081,12 @@
 	initialized = 1;
 }
 
+#ifdef MODULE
 static void cdrom_sysctl_unregister(void)
 {
 	unregister_sysctl_table(cdrom_sysctl_header);
 }
+#endif
 #endif /* endif CONFIG_SYSCTL */
 
 #ifdef MODULE
--- linux-2.1/drivers/char/console.c.~1~	Mon Aug 10 18:23:45 1998
+++ linux-2.1/drivers/char/console.c	Mon Aug 10 23:35:55 1998
@@ -86,7 +86,6 @@
 #include <linux/selection.h>
 #include <linux/console_struct.h>
 #include <linux/kbd_kern.h>
-#include <linux/vt_kern.h>
 #include <linux/consolemap.h>
 #include <linux/timer.h>
 #include <linux/interrupt.h>
@@ -197,7 +196,7 @@
 	return p;
 }
 
-static inline void scrolldelta(int lines)
+static void scrolldelta(int lines)
 {
 	int currcons = fg_console;
 
@@ -453,9 +452,9 @@
 	int i = scr_readw((u16 *) pos);
 	u32 type = cursor_type;
 
+	if (! (type & 0x10)) return;
 	if (softcursor_original != -1) return;
 	softcursor_original = i;
-	if (! (type & 0x10)) return;
 	i |= ((type >> 8) & 0xff00 );
 	i ^= ((type) & 0xff00 );
 	if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000;
@@ -467,6 +466,8 @@
 
 static void hide_cursor(int currcons)
 {
+	if (currcons == sel_cons)
+		clear_selection();
 	if (softcursor_original != -1) {
 		scr_writew(softcursor_original,(u16 *) pos);
 		if (DO_UPDATE)
@@ -481,6 +482,8 @@
     if (!IS_FG || console_blanked || vcmode == KD_GRAPHICS)
 	return;
     if (deccm) {
+	if (currcons == sel_cons)
+		clear_selection();
 	add_softcursor(currcons);
 	if ((cursor_type & 0x0f) != 1)
 	    sw->con_cursor(vc_cons[currcons].d,CM_DRAW);
@@ -527,8 +530,6 @@
 	}
 	lock = 1;
 
-	clear_selection();
-
 	hide_cursor(currcons);
 	if (fg_console != new_console) {
 		display = vc_cons[new_console].d->vc_display_fg;
@@ -1687,14 +1688,10 @@
 			/* DEC screen alignment test. kludge :-) */
 			video_erase_char =
 				(video_erase_char & 0xff00) | 'E';
-			/* Arno:
-			 * Doesn't work, because csi_J(c,2)
-			 * calls con_clear and doesn't print
-			 * the erase char..	FIXME
-			 */
 			csi_J(currcons, 2);
 			video_erase_char =
 				(video_erase_char & 0xff00) | ' ';
+			do_update_region(currcons, origin, screenbuf_size/2);
 		}
 		return;
 	case ESsetG0:
@@ -1766,10 +1763,6 @@
 	himask = hi_font_mask;
 	charmask = himask ? 0x1ff : 0xff;
 
-	/* clear the selection */
-	if (currcons == sel_cons)
-		clear_selection();
-
 	/* undraw cursor first */
 	if (IS_FG)
 		hide_cursor(currcons);
@@ -1906,7 +1899,6 @@
 	run_task_queue(&con_task_queue);
 	if (want_console >= 0) {
 		if (want_console != fg_console && vc_cons_allocated(want_console)) {
-			clear_selection();
 			hide_cursor(fg_console);
 			save_screen();
 			change_console(want_console);
@@ -2299,7 +2291,6 @@
 			vc_cons[currcons].d->vc_palette[k++] = default_blu[j] ;
 		}
 	}
-
 	currcons = fg_console = 0;
 	master_display_fg = vc_cons[currcons].d;
 	set_origin(currcons);
@@ -2415,8 +2406,8 @@
 
 	/* entering graphics mode? */
 	if (nopowersave) {
-		save_screen();
 		hide_cursor(currcons);
+		save_screen();
 		sw->con_blank(vc_cons[currcons].d, -1);
 		console_blanked = fg_console + 1;
 		set_origin(currcons);
@@ -2474,6 +2465,9 @@
 
 	currcons = fg_console;
 	console_blanked = 0;
+#ifdef CONFIG_APM
+	apm_display_unblank();
+#endif
 	if (sw->con_blank(vc_cons[currcons].d, 0))
 		/* Low-level driver cannot restore -> do it ourselves */
 		update_screen(fg_console);
@@ -2586,7 +2580,7 @@
 int con_font_op(int currcons, struct console_font_op *op)
 {
 	int rc = -EINVAL;
-	int size, set;
+	int size = max_font_size, set;
 	u8 *temp = NULL;
 	struct console_font_op old_op;
 
@@ -2626,10 +2620,9 @@
 		if (size > max_font_size)
 			return -ENOSPC;
 		set = 1;
-	} else if (op->op == KD_FONT_OP_GET) {
-		size = max_font_size;
+	} else if (op->op == KD_FONT_OP_GET)
 		set = 0;
-	} else
+	else
 		return sw->con_font_op(vc_cons[currcons].d, op);
 	if (op->data) {
 		temp = kmalloc(size, GFP_KERNEL);
@@ -2698,6 +2691,22 @@
 {
 	gotoxy(currcons, p[0], p[1]);
 	set_cursor(currcons);
+}
+
+u16 vcs_scr_readw(int currcons, u16 *org)
+{
+	if ((unsigned long)org == pos && softcursor_original != -1)
+		return softcursor_original;
+	return scr_readw(org);
+}
+
+void vcs_scr_writew(int currcons, u16 val, u16 *org)
+{
+	scr_writew(val, org);
+	if ((unsigned long)org == pos) {
+		softcursor_original = -1;
+		add_softcursor(currcons);
+	}
 }
 
 
--- linux-2.1/drivers/char/fbmem.c.~1~	Wed Jul 29 19:03:15 1998
+++ linux-2.1/drivers/char/fbmem.c	Mon Aug 10 21:11:28 1998
@@ -159,9 +159,6 @@
 static int num_pref_init_funcs __initdata = 0;
 
 
-#define GET_INODE(i) MKDEV(FB_MAJOR, (i) << FB_MODES_SHIFT)
-#define GET_FB_VAR_IDX(node) (MINOR(node) & ((1 << FB_MODES_SHIFT)-1)) 
-
 struct fb_info *registered_fb[FB_MAX];
 int num_registered_fb = 0;
 
@@ -192,7 +189,7 @@
 	for (fi = registered_fb; fi < &registered_fb[FB_MAX] && len < 4000; fi++)
 		if (*fi)
 			len += sprintf(buf + len, "%d %s\n",
-				       GET_FB_IDX((*fi)->node),
+				       (*fi)->node,
 				       (*fi)->modename);
 	*start = buf + offset;
 	return len > offset ? len - offset : 0;
@@ -485,7 +482,7 @@
 	for (i = 0 ; i < FB_MAX; i++)
 		if (!registered_fb[i])
 			break;
-	fb_info->node=GET_INODE(i);
+	fb_info->node = i;
 	registered_fb[i] = fb_info;
 	if (!fb_ever_opened[i]) {
 		/*
@@ -511,7 +508,7 @@
 {
 	int i, j;
 
-	i = GET_FB_IDX(fb_info->node);
+	i = fb_info->node;
 	for (j = 0; j < MAX_NR_CONSOLES; j++)
 		if (con2fb_map[j] == i)
 			return -EBUSY;
--- linux-2.1/drivers/char/vc_screen.c.~1~	Mon Jul 13 18:38:53 1998
+++ linux-2.1/drivers/char/vc_screen.c	Mon Aug 10 19:41:32 1998
@@ -7,7 +7,8 @@
  *            [minor: N]
  *
  * /dev/vcsaN: idem, but including attributes, and prefixed with
- *	the 4 bytes lines,columns,x,y (as screendump used to give)
+ *	the 4 bytes lines,columns,x,y (as screendump used to give).
+ *	Attribute/character pair is in native endianity.
  *            [minor: N+128]
  *
  * This replaces screendump and part of selection, so that the system
@@ -39,18 +40,6 @@
 #undef addr
 #define HEADER_SIZE	4
 
-static unsigned short
-func_scr_readw(unsigned short *org)
-{
-return scr_readw( org );
-}
-
-static void
-func_scr_writew(unsigned short val, unsigned short *org)
-{
-scr_writew( val, org );
-}
-
 static int
 vcs_size(struct inode *inode)
 {
@@ -91,7 +80,7 @@
 	return file->f_pos;
 }
 
-#define RETURN( x ) { enable_bh( CONSOLE_BH ); return x; }
+#define RETURN(x) { enable_bh(CONSOLE_BH); return x; }
 static ssize_t
 vcs_read(struct file *file, char *buf, size_t count, loff_t *ppos)
 {
@@ -104,7 +93,7 @@
 
 	attr = (currcons & 128);
 	currcons = (currcons & 127);
-	disable_bh( CONSOLE_BH );
+	disable_bh(CONSOLE_BH);
 	if (currcons == 0) {
 		currcons = fg_console;
 		viewed = 1;
@@ -125,7 +114,7 @@
 	if (!attr) {
 		org = screen_pos(currcons, p, viewed);
 		while (count-- > 0)
-			put_user(func_scr_readw(org++) & 0xff, buf++);
+			put_user(vcs_scr_readw(currcons, org++) & 0xff, buf++);
 	} else {
 		if (p < HEADER_SIZE) {
 			char header[HEADER_SIZE];
@@ -140,21 +129,21 @@
 		    org = screen_pos(currcons, p/2, viewed);
 		    if ((p & 1) && count > 0)
 #ifdef __BIG_ENDIAN
-			    { count--; put_user(func_scr_readw(org++) & 0xff, buf++); }
+			    { count--; put_user(vcs_scr_readw(currcons, org++) & 0xff, buf++); }
 #else
-			    { count--; put_user(func_scr_readw(org++) >> 8, buf++); }
+			    { count--; put_user(vcs_scr_readw(currcons, org++) >> 8, buf++); }
 #endif
 		}
 		while (count > 1) {
-			put_user(func_scr_readw(org++), (unsigned short *) buf);
+			put_user(vcs_scr_readw(currcons, org++), (unsigned short *) buf);
 			buf += 2;
 			count -= 2;
 		}
 		if (count > 0)
 #ifdef __BIG_ENDIAN
-			put_user(func_scr_readw(org) >> 8, buf++);
+			put_user(vcs_scr_readw(currcons, org) >> 8, buf++);
 #else
-			put_user(func_scr_readw(org) & 0xff, buf++);
+			put_user(vcs_scr_readw(currcons, org) & 0xff, buf++);
 #endif
 	}
 	read = buf - buf0;
@@ -170,11 +159,11 @@
 	long p = *ppos;
 	long viewed, attr, size, written;
 	const char *buf0;
-	unsigned short *org = NULL;
+	u16 *org0 = NULL, *org = NULL;
 
 	attr = (currcons & 128);
 	currcons = (currcons & 127);
-	disable_bh( CONSOLE_BH );
+	disable_bh(CONSOLE_BH);
 	if (currcons == 0) {
 		currcons = fg_console;
 		viewed = 1;
@@ -193,12 +182,12 @@
 
 	buf0 = buf;
 	if (!attr) {
-		org = screen_pos(currcons, p, viewed);
+		org0 = org = screen_pos(currcons, p, viewed);
 		while (count > 0) {
 			unsigned char c;
 			count--;
 			get_user(c, (const unsigned char*)buf++);
-			func_scr_writew((func_scr_readw(org) & 0xff00) | c, org);
+			vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff00) | c, org);
 			org++;
 		}
 	} else {
@@ -211,18 +200,18 @@
 				putconsxy(currcons, header+2);
 		}
 		if (count > 0) {
-		    p -= HEADER_SIZE;
-			org = screen_pos(currcons, p/2, viewed);
+			p -= HEADER_SIZE;
+			org0 = org = screen_pos(currcons, p/2, viewed);
 			if ((p & 1) && count > 0) {
 			    char c;
 				count--;
 				get_user(c,buf++);
 #ifdef __BIG_ENDIAN
-				func_scr_writew(c |
-				     (func_scr_readw(org) & 0xff00), org);
+				vcs_scr_writew(currcons, c |
+				     (vcs_scr_readw(currcons, org) & 0xff00), org);
 #else
-				func_scr_writew((c << 8) |
-				     (func_scr_readw(org) & 0xff), org);
+				vcs_scr_writew(currcons, (c << 8) |
+				     (vcs_scr_readw(currcons, org) & 0xff), org);
 #endif
 				org++;
 			}
@@ -230,7 +219,7 @@
 		while (count > 1) {
 			unsigned short w;
 			get_user(w, (const unsigned short *) buf);
-			func_scr_writew(w, org++);
+			vcs_scr_writew(currcons, w, org++);
 			buf += 2;
 			count -= 2;
 		}
@@ -238,15 +227,14 @@
 			unsigned char c;
 			get_user(c, (const unsigned char*)buf++);
 #ifdef __BIG_ENDIAN
-			func_scr_writew((func_scr_readw(org) & 0xff) | (c << 8), org);
+			vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff) | (c << 8), org);
 #else
-			func_scr_writew((func_scr_readw(org) & 0xff00) | c, org);
+			vcs_scr_writew(currcons, (vcs_scr_readw(currcons, org) & 0xff00) | c, org);
 #endif
 		}
 	}
-	if (currcons == fg_console)
-		/* Horribly inefficient if count < screen size.  */
-		update_screen(currcons);
+	if (org0)
+		update_region(currcons, (unsigned long)(org0), org-org0);
 	written = buf - buf0;
 	*ppos += written;
 	RETURN( written );
--- linux-2.1/drivers/char/vt.c.~1~	Mon Aug 10 18:24:24 1998
+++ linux-2.1/drivers/char/vt.c	Mon Aug 10 19:37:51 1998
@@ -121,22 +121,18 @@
 }
 
 /*
- * Generates sound of some count for some number of clock ticks
- * [count = 1193180 / frequency]
+ * Generates sound of some frequency for some number of clock ticks
  *
  * If freq is 0, will turn off sound, else will turn it on for that time.
  * If msec is 0, will return immediately, else will sleep for msec time, then
  * turn sound off.
  *
- * We use the BEEP_TIMER vector since we're using the same method to
- * generate sound, and we'll overwrite any beep in progress. That may
- * be something to fix later, if we like.
- *
  * We also return immediately, which is what was implied within the X
  * comments - KDMKTONE doesn't put the process to sleep.
  */
-/* FIXME: This should go to arch-dependent code */
-#if !defined (__mc68000__)
+
+#if defined(__i386__) || defined(__alpha__) || defined(__powerpc__) || defined(__mips__)
+
 static void
 kd_nosound(unsigned long ignored)
 {
@@ -177,20 +173,16 @@
 	return;
 }
 
-void (*kd_mksound)(unsigned int hz, unsigned int ticks) = _kd_mksound;
+#else
 
-#else /* __mc68000__ */
-void dummy_mksound(unsigned int say, unsigned int nothing)
+void
+_kd_mksound(unsigned int hz, unsigned int ticks)
 {
-  /* We are real quiet in here ;-) */
 }
 
-/*
- * Since this is machine-dependent, systems with a sound-device should
- * change this value in arch/m68k/{amiga,atari,x}/config.c.
- */
-void (*kd_mksound)(unsigned int hz, unsigned int ticks) = dummy_mksound;
 #endif
+
+void (*kd_mksound)(unsigned int hz, unsigned int ticks) = _kd_mksound;
 
 
 #define i (tmp.kb_index)
--- linux-2.1/drivers/video/atafb.c.~1~	Mon Aug 10 18:27:53 1998
+++ linux-2.1/drivers/video/atafb.c	Mon Jul 27 19:06:05 1998
@@ -47,7 +47,6 @@
 #define ATAFB_EXT
 #define ATAFB_FALCON
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
--- linux-2.1/drivers/video/dummycon.c.~1~	Mon Aug 10 18:28:11 1998
+++ linux-2.1/drivers/video/dummycon.c	Mon Aug  3 20:39:45 1998
@@ -5,6 +5,7 @@
  *  available, usually until fbcon takes console over.
  */
 
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kdev_t.h>
 #include <linux/tty.h>
--- linux-2.1/drivers/video/fbcon-iplan2p2.h.~1~	Mon Aug 10 18:28:17 1998
+++ linux-2.1/drivers/video/fbcon-iplan2p2.h	Mon Jul 27 19:09:31 1998
@@ -2,6 +2,8 @@
      *  Atari interleaved bitplanes (2 planes) (iplan2p2)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_IPLAN2P2) || defined(CONFIG_FBCON_IPLAN2P2_MODULE)
 #define FBCON_HAS_IPLAN2P2
--- linux-2.1/drivers/video/fbcon-iplan2p4.h.~1~	Mon Aug 10 18:28:18 1998
+++ linux-2.1/drivers/video/fbcon-iplan2p4.h	Mon Jul 27 19:09:47 1998
@@ -2,6 +2,8 @@
      *  Atari interleaved bitplanes (4 planes) (iplan2p4)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_IPLAN2P4) || defined(CONFIG_FBCON_IPLAN2P4_MODULE)
 #define FBCON_HAS_IPLAN2P4
--- linux-2.1/drivers/video/fbcon-iplan2p8.h.~1~	Mon Aug 10 18:28:19 1998
+++ linux-2.1/drivers/video/fbcon-iplan2p8.h	Mon Jul 27 19:10:08 1998
@@ -2,6 +2,8 @@
      *  Atari interleaved bitplanes (8 planes) (iplan2p8)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_IPLAN2P8) || defined(CONFIG_FBCON_IPLAN2P8_MODULE)
 #define FBCON_HAS_IPLAN2P8
--- linux-2.1/drivers/video/fbcon-mfb.h.~1~	Mon Aug 10 18:28:20 1998
+++ linux-2.1/drivers/video/fbcon-mfb.h	Mon Jul 27 19:10:27 1998
@@ -2,6 +2,8 @@
      *  Monochrome (mfb)
      */
 
+#include <linux/config.h>
+
 #ifdef MODULE
 #if defined(CONFIG_FBCON_MFB) || defined(CONFIG_FBCON_MFB_MODULE)
 #define FBCON_HAS_MFB
--- linux-2.1/drivers/video/fbcon.c.~1~	Mon Aug 10 18:28:22 1998
+++ linux-2.1/drivers/video/fbcon.c	Wed Jul 29 23:18:33 1998
@@ -1167,6 +1167,7 @@
 {
     struct display *p = &fb_display[unit];
     u8 *data = op->data;
+    u8 *fontdata = p->fontdata;
     int i, j;
 
 #ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
@@ -1180,37 +1181,44 @@
     if (op->width <= 8) {
     	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < p->fontheight; j++)
-		*data++ = p->fontdata[i*p->fontheight+j];
-	    data += 32 - p->fontheight;
+		*data++ = *fontdata++;
+	    for (; j < 32; j++)
+		*data++ = 0;
 	}
     }
 #ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     else if (op->width <= 16) {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < p->fontheight; j++) {
-		*data++ = ((u16 *)p->fontdata)[i*p->fontheight+j] >> 8;
-		*data++ = ((u16 *)p->fontdata)[i*p->fontheight+j];
+		*data++ = *(u16 *)fontdata >> 8;
+		*data++ = *(u16 *)fontdata;
+		fontdata += sizeof(u16);
 	    }
-	    data += 2 * (32 - p->fontheight);
+	    for (; j < 32 * 2; j++)
+		*data++ = 0;
 	}
     } else if (op->width <= 24) {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < p->fontheight; j++) {
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 24;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 16;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 8;
+		*data++ = *(u32 *)fontdata >> 24;
+		*data++ = *(u32 *)fontdata >> 16;
+		*data++ = *(u32 *)fontdata >> 8;
+		fontdata += sizeof(u32);
 	    }
-	    data += 3 * (32 - p->fontheight);
+	    for (; j < 32 * 3; j++)
+		*data++ = 0;
 	}
     } else {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < p->fontheight; j++) {
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 24;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 16;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j] >> 8;
-		*data++ = ((u32 *)p->fontdata)[i*p->fontheight+j];
+		*data++ = *(u32 *)fontdata >> 24;
+		*data++ = *(u32 *)fontdata >> 16;
+		*data++ = *(u32 *)fontdata >> 8;
+		*data++ = *(u32 *)fontdata;
+		fontdata += sizeof(u32);
 	    }
-	    data += 4 * (32 - p->fontheight);
+	    for (; j < 4 * 32; j++)
+		*data++ = 0;
 	}
     }
 #endif
@@ -1222,6 +1230,7 @@
 #define FNTSIZE(fd)	(((int *)(fd))[-2])
 #define FNTCHARCNT(fd)	(((int *)(fd))[-3])
 #define FNTSUM(fd)	(((int *)(fd))[-4])
+#define FONT_EXTRA_WORDS 4
 
 static int fbcon_do_set_font(int unit, struct console_font_op *op, u8 *data, int userfont)
 {
@@ -1233,8 +1242,8 @@
     char *old_data = NULL;
 
     if (!fontwidthvalid(p,w)) {
-        if (userfont)
-	    kfree(data);
+        if (userfont && op->op != KD_FONT_OP_COPY)
+	    kfree(data - FONT_EXTRA_WORDS*sizeof(int));
 	return -ENXIO;
     }
 
@@ -1280,7 +1289,7 @@
 	update_screen( unit );
 
     if (old_data && (--REFCOUNT(old_data) == 0))
-	kfree( old_data - 4*sizeof(int) );
+	kfree(old_data - FONT_EXTRA_WORDS*sizeof(int));
 
     return 0;
 }
@@ -1309,7 +1318,9 @@
     int size = h;
     int i, j, k;
     u8 *new_data, *data = op->data, c, *p;
+#ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     u32 d;
+#endif
 
 #ifdef CONFIG_FBCON_FONTWIDTH8_ONLY
     if (w != 8)
@@ -1327,57 +1338,59 @@
     }
     size *= op->charcount;
        
-    if (!(new_data = kmalloc( 4*sizeof(int)+size, GFP_USER )))
+    if (!(new_data = kmalloc(FONT_EXTRA_WORDS*sizeof(int)+size, GFP_USER)))
         return -ENOMEM;
-    new_data += 4*sizeof(int);
+    new_data += FONT_EXTRA_WORDS*sizeof(int);
     FNTSIZE(new_data) = size;
     FNTCHARCNT(new_data) = op->charcount;
     REFCOUNT(new_data) = 0; /* usage counter */
     k = 0;
-    p = data;
+    p = new_data;
     if (w <= 8) {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < h; j++) {
-	        c = *p++;
+	        c = *data++;
 		k += c;
-		new_data[i*h+j] = c;
+		*p++ = c;
 	    }
-	    p += 32 - h;
+	    data += 32 - h;
 	}
     }
 #ifndef CONFIG_FBCON_FONTWIDTH8_ONLY
     else if (w <= 16) {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < h; j++) {
-	        d = (p[0] << 8) | p[1];
-	        p += 2;
+	        d = (data[0] << 8) | data[1];
+	        data += 2;
 		k += d;
-		((u16 *)new_data)[i*h+j] = d;
+		*(u16 *)p = d;
+		p += sizeof(u16);
 	    }
-	    p += 2*(32 - h);
+	    data += 2*(32 - h);
 	}
     } else {
 	for (i = 0; i < op->charcount; i++) {
 	    for (j = 0; j < h; j++) {
 	    	if (w <= 24) {
-		    d = (p[0] << 24) | 
-			(p[1] << 16) | 
-			(p[2] << 8);
-		    p += 3;
+		    d = (data[0] << 24) | 
+			(data[1] << 16) | 
+			(data[2] << 8);
+		    data += 3;
 		} else {
-		    d = (p[0] << 24) | 
-			(p[1] << 16) | 
-			(p[2] << 8) |
-			p[3];
-		    p += 4;
+		    d = (data[0] << 24) | 
+			(data[1] << 16) | 
+			(data[2] << 8) |
+			data[3];
+		    data += 4;
 		}
 		k += d;
-		((u32 *)new_data)[i*h+j] = d;
+		*(u32 *)p = d;
+		p += sizeof(u32);
 	    }
 	    if (w <= 24)
-	    	p += 3*(32 - h);
+	    	data += 3*(32 - h);
 	    else
-	        p += 4*(32 - h);
+	        data += 4*(32 - h);
 	}
     }
 #endif
@@ -1389,7 +1402,7 @@
     	    FNTSUM(fb_display[i].fontdata) == k &&
     	    FNTSIZE(fb_display[i].fontdata) == size &&
 	    !memcmp(fb_display[i].fontdata, new_data, size)) {
-	    kfree(new_data - 4*sizeof(int));
+	    kfree(new_data - FONT_EXTRA_WORDS*sizeof(int));
 	    new_data = fb_display[i].fontdata;
 	    break;
     	}
@@ -1516,6 +1529,11 @@
     return 0;
 }
 
+static inline unsigned safe_shift(unsigned d,int n)
+{
+    return n<0 ? d>>-n : d<<n;
+}
+
 __initfunc(static int fbcon_show_logo( void ))
 {
     struct display *p = &fb_display[fg_console]; /* draw to vt in foreground */
@@ -1665,9 +1683,9 @@
 	    for( y1 = 0; y1 < LOGO_H; y1++ ) {
 		dst = fb + y1*line + x*bdepth;
 		for( x1 = 0; x1 < LOGO_W; x1++, src++ ) {
-		    val = ((linux_logo_red[*src-32]   & redmask)   << redshift) |
-		          ((linux_logo_green[*src-32] & greenmask) << greenshift) |
-		          ((linux_logo_blue[*src-32]  & bluemask)  << blueshift);
+		    val = safe_shift((linux_logo_red[*src-32]   & redmask), redshift) |
+		          safe_shift((linux_logo_green[*src-32] & greenmask), greenshift) |
+		          safe_shift((linux_logo_blue[*src-32]  & bluemask), blueshift);
 #ifdef __LITTLE_ENDIAN
 		    for( i = 0; i < bdepth; ++i )
 #else
--- linux-2.1/fs/ext2/truncate.c.~1~	Mon Jul 13 18:40:48 1998
+++ linux-2.1/fs/ext2/truncate.c	Fri Jun 26 18:52:29 1998
@@ -62,8 +62,6 @@
 #define TINDIRECT_BLOCK(inode,offset) \
 	(INDIRECT_BLOCK(inode,offset) / (addr_per_block*addr_per_block))
 
-static u32 le32_zero = 0;
-
 /*
  * Truncate has the most races in the whole filesystem: coding it is
  * a pain in the a**. Especially as I don't do any locking...
@@ -128,18 +126,16 @@
 	} while (retry);
 
 	for (i = 0; i < addr_per_block; i++)
-		if (le32_to_cpu(*(ind++)))
+		if (*(ind++))
 			goto in_use;
 
 	if (bh->b_count == 1) {
 		int tmp;
-		if (ind_bh) {
+		if (ind_bh)
 			tmp = le32_to_cpu(*p);
-			*p = le32_zero;
-		} else {
+		else
 			tmp = *p;
-			*p = 0;
-		}
+		*p = 0;
 		inode->i_blocks -= (inode->i_sb->s_blocksize / 512);
 		mark_inode_dirty(inode);
 		/*
@@ -232,13 +228,11 @@
 		ext2_error(inode->i_sb, "trunc_indirect",
 			"Read failure, inode=%ld, block=%d",
 			inode->i_ino, tmp);
-		if (dind_bh) {
-			*p = le32_zero;
+		*p = 0;
+		if (dind_bh)
 			mark_buffer_dirty(dind_bh, 1);
-		} else {
-			*p = 0;
+		else
 			mark_inode_dirty(inode);
-		}
 		return 0;
 	}
 
@@ -268,7 +262,7 @@
 			}
 		}
 
-		*ind = le32_zero;
+		*ind = 0;
 		inode->i_blocks -= blocks;
 		mark_inode_dirty(inode);
 		bforget(bh);
@@ -316,13 +310,11 @@
 		ext2_error(inode->i_sb, "trunc_dindirect",
 			"Read failure, inode=%ld, block=%d",
 			inode->i_ino, tmp);
-		if (tind_bh) {
-			*p = le32_zero;
+		*p = 0;
+		if (tind_bh)
 			mark_buffer_dirty(tind_bh, 1);
-		} else {
-			*p = 0;
+		else
 			mark_inode_dirty(inode);
-		}
 		return 0;
 	}
 
--- linux-2.1/fs/proc/array.c.~1~	Mon Aug 10 18:29:10 1998
+++ linux-2.1/fs/proc/array.c	Sat Aug  8 17:29:08 1998
@@ -60,7 +60,6 @@
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
-#include <asm/shmparam.h>
 
 #define LOAD_INT(x) ((x) >> FSHIFT)
 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
@@ -983,7 +982,7 @@
 				trs += pages;	/* text */
 			else if (vma->vm_flags & VM_GROWSDOWN)
 				drs += pages;	/* stack */
-			else if (vma->vm_end > SHM_RANGE_START)
+			else if (vma->vm_end > TASK_UNMAPPED_BASE)
 				lrs += pages;	/* library */
 			else
 				drs += pages;
--- linux-2.1/include/asm-m68k/bitops.h.~1~	Mon Aug 10 18:30:01 1998
+++ linux-2.1/include/asm-m68k/bitops.h	Wed Jul 22 19:04:18 1998
@@ -236,8 +236,6 @@
 #define hweight16(x) generic_hweight16(x)
 #define hweight8(x) generic_hweight8(x)
 
-#endif /* __KERNEL__ */
-
 /* Bitmap functions for the minix filesystem */
 
 extern __inline__ int
@@ -365,5 +363,7 @@
 	res = ext2_find_first_zero_bit (p, size - 32 * (p - addr));
 	return (p - addr) * 32 + res;
 }
+
+#endif /* __KERNEL__ */
 
 #endif /* _M68K_BITOPS_H */
--- linux-2.1/include/asm-m68k/pgtable.h.~1~	Mon Aug 10 18:30:04 1998
+++ linux-2.1/include/asm-m68k/pgtable.h	Mon Aug 10 19:27:32 1998
@@ -632,7 +632,7 @@
 	ret = pte_quicklist;
 	if (ret) {
 		pte_quicklist = (unsigned long *)*ret;
-		ret[0] = ret[1];
+		ret[0] = 0;
 		quicklists.pgtable_cache_sz -= 8;
 	}
 	return (pte_t *)ret;
@@ -658,7 +658,7 @@
 	ret = pmd_quicklist;
 	if (ret) {
 		pmd_quicklist = (unsigned long *)*ret;
-		ret[0] = ret[1];
+		ret[0] = 0;
 		quicklists.pgtable_cache_sz--;
 	}
 	return (pmd_t *)ret;
--- linux-2.1/include/asm-m68k/spinlock.h.~1~	Tue May 20 17:51:06 1997
+++ linux-2.1/include/asm-m68k/spinlock.h	Mon Aug 10 19:56:34 1998
@@ -5,8 +5,16 @@
  * We don't do SMP on the m68k .... at least not yet.
  */
 
-typedef struct { int dummy; } spinlock_t;
+/*
+ * Gcc-2.7.x has a nasty bug with empty initializers.
+ */
+#if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8)
+typedef struct { } spinlock_t;
+#define SPIN_LOCK_UNLOCKED { }
+#else
+typedef struct { int gcc_is_buggy; } spinlock_t;
 #define SPIN_LOCK_UNLOCKED { 0 }
+#endif
 
 #define spin_lock_init(lock)	do { } while(0)
 #define spin_lock(lock)		do { } while(0)
@@ -31,8 +39,8 @@
  * irq-safe write-lock, but readers can get non-irqsafe
  * read-locks.
  */
-typedef struct { int dummy; } rwlock_t;
-#define RW_LOCK_UNLOCKED { 0 }
+typedef struct { } rwlock_t;
+#define RW_LOCK_UNLOCKED { }
 
 #define read_lock(lock)		do { } while(0)
 #define read_unlock(lock)	do { } while(0)
--- linux-2.1/include/asm-m68k/unistd.h.~1~	Mon Aug 10 18:30:06 1998
+++ linux-2.1/include/asm-m68k/unistd.h	Sat Aug  8 09:37:27 1998
@@ -192,6 +192,8 @@
 #define __NR_capset		185
 #define __NR_sigaltstack	186
 #define __NR_sendfile		187
+#define __NR_streams1		188	/* some people actually want it */
+#define __NR_streams2		189	/* some people actually want it */
 
 /* user-visible error numbers are in the range -1 - -122: see
    <asm-m68k/errno.h> */
@@ -313,6 +315,8 @@
 static inline _syscall0(int,sync)
 static inline _syscall0(pid_t,setsid)
 static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
+static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
+static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
 static inline _syscall1(int,dup,int,fd)
 static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
 static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
--- linux-2.1/include/linux/selection.h.~1~	Mon Aug 10 18:31:11 1998
+++ linux-2.1/include/linux/selection.h	Mon Aug 10 19:44:08 1998
@@ -40,4 +40,7 @@
 extern void getconsxy(int currcons, char *p);
 extern void putconsxy(int currcons, char *p);
 
+extern u16 vcs_scr_readw(int currcons, u16 *org);
+extern void vcs_scr_writew(int currcons, u16 val, u16 *org);
+
 #endif
--- linux-2.1/scripts/lxdialog/menubox.c.~1~	Mon Aug 10 18:32:11 1998
+++ linux-2.1/scripts/lxdialog/menubox.c	Wed Jul 22 19:24:58 1998
@@ -310,7 +310,7 @@
                     choice = MIN(choice+1, max_choice-1);
 
 	    } else if (key == KEY_PPAGE) {
-  	        scrollok (menu, TRUE);
+	        scrollok (menu, TRUE);
                 for (i=0; (i < max_choice); i++) {
                     if (scroll > 0) {
                 	wscrl (menu, -1);
@@ -321,6 +321,9 @@
                         if (choice > 0)
                             choice--;
                     }
+                }
+                scrollok (menu, FALSE);
+
             } else if (key == KEY_NPAGE) {
                 for (i=0; (i < max_choice); i++) {
                     if (scroll+max_choice < item_no) {
@@ -335,6 +338,8 @@
 			if (choice+1 < max_choice)
 			    choice++;
 		    }
+                }
+
             } else
                 choice = i;
 
