To: Jes Sorensen <Jes.Sorensen@cern.ch>
Cc: linux-m68k@lists.linux-m68k.org
Subject: Re: L68K: 2.1.119 is out
References: <199808281833.UAA03229@valhall.cern.ch>
X-Yow: Yow!  Now I get to think about all the BAD THINGS I did to a BOWLING BALL
 when I was in JUNIOR HIGH SCHOOL!
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: 01 Sep 1998 10:25:49 +0200
In-Reply-To: Jes Sorensen's message of "Fri, 28 Aug 1998 20:33:25 +0200 (MET DST)"
Sender: owner-linux-m68k@phil.uni-sb.de

Only a few changes are needed this time:

- arch/m68k/lib/checksum.c, include/asm-m68k/checksum.h: Fix
  csum_partial_copy_from_user to zero out rest of buffer if an exception
  occurs.  Remove obsolete csum_partial_copy_fromuser.
- arch/m68k/kernel/entry.S: Fix support for umount2 syscall.
- arch/m68k/kernel/process.c: Don't lock_kernel in m68k_fork and
  m68k_clone, do_fork does that already.
- drivers/char/console.c: Remove duplicate inclusion of
  <linux/vt_kern.h>.
- fs/proc/array.c: Allow the kernel stack to grow past 4k when looking for
  wchan.
- include/linux/fs.h, init/main.c: Don't make real_root_dev a kdev_t
  (which is short) to work with sysctl (look at kernel/sysctl.c for
  clues).
- arch/m68k/atari/stram.c, drivers/cdrom/cdrom.c: Remove some gratuitous
  difference with mainstream kernel.

Andreas.

----------------------------------------------------------------------
--- linux-2.1/arch/m68k/atari/stram.c.~1~	Mon Aug 31 18:03:49 1998
+++ linux-2.1/arch/m68k/atari/stram.c	Wed Aug 26 18:34:17 1998
@@ -215,31 +215,31 @@
 #ifdef CONFIG_STRAM_SWAP
 static int swap_init( unsigned long start_mem, unsigned long swap_data );
 static inline int unswap_pte( struct vm_area_struct * vma, unsigned long
-                              address, pte_t *dir, unsigned long entry,
-                              unsigned long page, int isswap );
+			      address, pte_t *dir, unsigned long entry,
+			      unsigned long page, int isswap );
 static inline int unswap_pmd( struct vm_area_struct * vma, pmd_t *dir,
-                              unsigned long address, unsigned long size,
-                              unsigned long offset, unsigned long entry,
-                              unsigned long page, int isswap );
+			      unsigned long address, unsigned long size,
+			      unsigned long offset, unsigned long entry,
+			      unsigned long page, int isswap );
 static inline int unswap_pgd( struct vm_area_struct * vma, pgd_t *dir,
-                              unsigned long address, unsigned long size,
-                              unsigned long entry, unsigned long page, int
-                              isswap );
+			      unsigned long address, unsigned long size,
+			      unsigned long entry, unsigned long page, int
+			      isswap );
 static int unswap_vma( struct vm_area_struct * vma, pgd_t *pgdir, unsigned
-                       long entry, unsigned long page, int isswap );
+		       long entry, unsigned long page, int isswap );
 static int unswap_process( struct mm_struct * mm, unsigned long entry,
-                           unsigned long page, int isswap );
+			   unsigned long page, int isswap );
 static int unswap_by_move(unsigned short *, unsigned long, unsigned long,
 			  unsigned long);
 static int unswap_by_read(unsigned short *, unsigned long, unsigned long,
 			  unsigned long);
 static void *get_stram_region( unsigned long n_pages );
 static void free_stram_region( unsigned long offset, unsigned long n_pages
-                               );
+			       );
 static int in_some_region( unsigned long addr );
 static unsigned long find_free_region( unsigned long n_pages, unsigned long
-                                       *total_free, unsigned long
-                                       *region_free );
+				       *total_free, unsigned long
+				       *region_free );
 static void do_stram_request( void );
 static int stram_open( struct inode *inode, struct file *filp );
 static int stram_release( struct inode *inode, struct file *filp );
--- linux-2.1/arch/m68k/kernel/entry.S.~1~	Mon Aug 31 18:03:53 1998
+++ linux-2.1/arch/m68k/kernel/entry.S	Mon Aug 31 18:36:34 1998
@@ -418,7 +418,7 @@
 	.long SYMBOL_NAME(sys_lseek)
 	.long SYMBOL_NAME(sys_getpid)		/* 20 */
 	.long SYMBOL_NAME(sys_mount)
-	.long SYMBOL_NAME(sys_umount)
+	.long SYMBOL_NAME(sys_oldumount)
 	.long SYMBOL_NAME(sys_setuid)
 	.long SYMBOL_NAME(sys_getuid)
 	.long SYMBOL_NAME(sys_stime)		/* 25 */
@@ -448,7 +448,7 @@
 	.long SYMBOL_NAME(sys_geteuid)
 	.long SYMBOL_NAME(sys_getegid)		/* 50 */
 	.long SYMBOL_NAME(sys_acct)
-	.long SYMBOL_NAME(sys_ni_syscall)				/* old phys syscall holder */
+	.long SYMBOL_NAME(sys_umount)					/* recycled never used phys() */
 	.long SYMBOL_NAME(sys_ni_syscall)				/* old lock syscall holder */
 	.long SYMBOL_NAME(sys_ioctl)
 	.long SYMBOL_NAME(sys_fcntl)		/* 55 */
--- linux-2.1/arch/m68k/kernel/process.c.~1~	Mon Aug 10 18:21:24 1998
+++ linux-2.1/arch/m68k/kernel/process.c	Wed Aug 26 18:35:36 1998
@@ -134,29 +134,20 @@
 
 asmlinkage int m68k_fork(struct pt_regs *regs)
 {
-	int ret;
-
-	lock_kernel();
-	ret = do_fork(SIGCHLD, rdusp(), regs);
-	unlock_kernel();
-	return ret;
+	return do_fork(SIGCHLD, rdusp(), regs);
 }
 
 asmlinkage int m68k_clone(struct pt_regs *regs)
 {
 	unsigned long clone_flags;
 	unsigned long newsp;
-	int ret;
 
-	lock_kernel();
 	/* syscall2 puts clone_flags in d1 and usp in d2 */
 	clone_flags = regs->d1;
 	newsp = regs->d2;
 	if (!newsp)
-	  newsp  = rdusp();
-	ret = do_fork(clone_flags, newsp, regs);
-	unlock_kernel();
-	return ret;
+		newsp = rdusp();
+	return do_fork(clone_flags, newsp, regs);
 }
 
 int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
--- linux-2.1/arch/m68k/lib/checksum.c.~1~	Mon Feb 17 17:33:12 1997
+++ linux-2.1/arch/m68k/lib/checksum.c	Tue Sep  1 01:31:36 1998
@@ -26,6 +26,10 @@
  *		modify it under the terms of the GNU General Public License
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
+ *
+ * 1998/8/31	Andreas Schwab:
+ *		Zero out rest of buffer on exception in
+ *		csum_partial_copy_from_user.
  */
 
 #include <net/checksum.h>
@@ -239,23 +243,71 @@
 	     "8:\n"
 		".section .fixup,\"ax\"\n"
 		".even\n"
+		/* If any execption occurs zero out the rest.
+		   Similarities with the code above are intentional :-) */
+	     "90:\t"
+		"clrw %3@+\n\t"
+		"movel %1,%4\n\t"
+		"lsrl #5,%1\n\t"
+		"jeq 1f\n\t"
+		"subql #1,%1\n"
+	     "91:\t"
+		"clrl %3@+\n"
+	     "92:\t"
+		"clrl %3@+\n"
+	     "93:\t"
+		"clrl %3@+\n"
+	     "94:\t"
+		"clrl %3@+\n"
+	     "95:\t"
+		"clrl %3@+\n"
+	     "96:\t"
+		"clrl %3@+\n"
+	     "97:\t"
+		"clrl %3@+\n"
+	     "98:\t"
+		"clrl %3@+\n\t"
+		"dbra %1,91b\n\t"
+		"clrw %1\n\t"
+		"subql #1,%1\n\t"
+		"jcc 91b\n"
+	     "1:\t"
+		"movel %4,%1\n\t"
+		"andw #0x1c,%4\n\t"
+		"jeq 1f\n\t"
+		"lsrw #2,%4\n\t"
+		"subqw #1,%4\n"
+	     "99:\t"
+		"clrl %3@+\n\t"
+		"dbra %4,99b\n\t"
+	     "1:\t"
+		"andw #3,%1\n\t"
+		"jeq 9f\n"
+	     "100:\t"
+		"clrw %3@+\n\t"
+		"tstw %1\n\t"
+		"jeq 9f\n"
+	     "101:\t"
+		"clrb %3@+\n"
 	     "9:\t"
-		"moveq #-14,%5\n\t"	/* -EFAULT, out of inputs to asm ;( */
+#define STR(X) STR1(X)
+#define STR1(X) #X
+		"moveq #-" STR(EFAULT) ",%5\n\t"
 		"jra 8b\n"
 		".previous\n"
 		".section __ex_table,\"a\"\n"
-		".long 10b,9b\n"
-		".long 11b,9b\n"
-		".long 12b,9b\n"
-		".long 13b,9b\n"
-		".long 14b,9b\n"
-		".long 15b,9b\n"
-		".long 16b,9b\n"
-		".long 17b,9b\n"
-		".long 18b,9b\n"
-		".long 19b,9b\n"
-		".long 20b,9b\n"
-		".long 21b,9b\n"
+		".long 10b,90b\n"
+		".long 11b,91b\n"
+		".long 12b,92b\n"
+		".long 13b,93b\n"
+		".long 14b,94b\n"
+		".long 15b,95b\n"
+		".long 16b,96b\n"
+		".long 17b,97b\n"
+		".long 18b,98b\n"
+		".long 19b,99b\n"
+		".long 20b,100b\n"
+		".long 21b,101b\n"
 		".previous"
 		: "=d" (sum), "=d" (len), "=a" (src), "=a" (dst),
 		  "=&d" (tmp1), "=d" (tmp2)
@@ -267,16 +319,6 @@
 	return(sum);
 }
 
-/*
- * This one will go away soon.
- */
-unsigned int
-csum_partial_copy_fromuser(const char *src, char *dst, int len, int sum)
-{
-	int dummy;
-
-	return csum_partial_copy_from_user(src, dst, len, sum, &dummy);
-}
 /*
  * copy from kernel space while checksumming, otherwise like csum_partial
  */
--- linux-2.1/drivers/cdrom/cdrom.c.~1~	Mon Aug 31 18:04:25 1998
+++ linux-2.1/drivers/cdrom/cdrom.c	Wed Aug 26 18:39:50 1998
@@ -1087,7 +1087,7 @@
 {
 	unregister_sysctl_table(cdrom_sysctl_header);
 }
-#endif
+#endif /* endif MODULE */
 #endif /* endif CONFIG_SYSCTL */
 
 #ifdef MODULE
--- linux-2.1/drivers/char/console.c.~1~	Mon Aug 31 18:04:43 1998
+++ linux-2.1/drivers/char/console.c	Mon Aug 31 18:49:39 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>
--- linux-2.1/fs/proc/array.c.~1~	Mon Aug 31 18:07:31 1998
+++ linux-2.1/fs/proc/array.c	Wed Aug 26 18:58:43 1998
@@ -531,10 +531,11 @@
 	    unsigned long stack_page;
 	    int count = 0;
 
-	    stack_page = PAGE_SIZE + (unsigned long)p;
+	    stack_page = (unsigned long)p;
 	    fp = ((struct switch_stack *)p->tss.ksp)->a6;
 	    do {
-		    if (fp < stack_page || fp >= 4088+stack_page)
+		    if (fp < stack_page+sizeof(struct task_struct) ||
+			fp >= 8184+stack_page)
 			    return 0;
 		    pc = ((unsigned long *)fp)[1];
 		/* FIXME: This depends on the order of these functions. */
--- linux-2.1/include/asm-m68k/checksum.h.~1~	Mon May  4 18:18:43 1998
+++ linux-2.1/include/asm-m68k/checksum.h	Tue Sep  1 01:29:49 1998
@@ -16,7 +16,7 @@
 unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum);
 
 /*
- * the same as csum_partial_copy, but copies from src while it
+ * the same as csum_partial, but copies from src while it
  * checksums
  *
  * here even more important to align src and dst on a 32-bit (or even
@@ -33,13 +33,9 @@
  * better 64-bit) boundary
  */
 
-unsigned int csum_partial_copy_fromuser(const char *src, char *dst, int len, int sum);
+extern unsigned int csum_partial_copy_from_user(const char *src, char *dst,
+						int len, int sum, int *csum_err);
 
-extern unsigned int
-csum_partial_copy_from_user ( const char *src, char *dst,
-			      int len, int sum, int *csum_err);
-
-/* FIXME: this needs to be written to really do no check -- Cort */
 #define csum_partial_copy_nocheck(src, dst, len, sum)	\
 	csum_partial_copy((src), (dst), (len), (sum))
 
--- linux-2.1/include/linux/fs.h.~1~	Mon Aug 31 18:08:16 1998
+++ linux-2.1/include/linux/fs.h	Wed Aug 26 19:33:53 1998
@@ -835,7 +835,7 @@
 extern void mount_root(void);
 
 #ifdef CONFIG_BLK_DEV_INITRD
-extern kdev_t real_root_dev;
+extern int real_root_dev;
 extern int change_root(kdev_t new_root_dev,const char *put_old);
 #endif
 
--- linux-2.1/init/main.c.~1~	Mon Aug 31 18:08:27 1998
+++ linux-2.1/init/main.c	Mon Aug 31 18:46:29 1998
@@ -334,7 +334,7 @@
 extern int rd_size;		/* Size of the ramdisk(s) */
 extern int rd_image_start;	/* starting block # of image */
 #ifdef CONFIG_BLK_DEV_INITRD
-kdev_t real_root_dev;
+int real_root_dev;		/* MUST be int for sysctl! */
 #endif
 #endif
 

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
schwab@gnu.org
