patch-2.2.18 linux/include/asm-m68k/uaccess.h

Next file: linux/include/asm-mips/page.h
Previous file: linux/include/asm-m68k/types.h
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/include/asm-m68k/uaccess.h linux/include/asm-m68k/uaccess.h
@@ -801,18 +801,20 @@
  *
  * Return 0 for error
  */
-static inline long strlen_user(const char * src)
+#define strlen_user(str) strnlen_user(str, ~0UL >> 1)
+static inline long strnlen_user(const char * src, long n)
 {
     long res = -(long) src;
     __asm__ __volatile__
-	("1: movesb (%1)+,%%d0\n"
+	("   subq #1,%2\n"
+	 "1: movesb (%1)+,%%d0\n"
 	 "12:tstb %%d0\n"
-	 "   jne 1b\n"
+	 "   dbeq %2,1b\n"
 	 "   addl %1,%0\n"
 	 "2:\n"
 	 ".section .fixup,\"ax\"\n"
 	 "   .even\n"
-	 "3: moveq %2,%0\n"
+	 "3: moveq #0,%0\n"
 	 "   jra 2b\n"
 	 ".previous\n"
 	 ".section __ex_table,\"a\"\n"
@@ -820,8 +822,8 @@
 	 "   .long 1b,3b\n"
 	 "   .long 12b,3b\n"
 	 ".previous"
-	 : "=d"(res), "=a"(src)
-	 : "i"(0), "0"(res), "1"(src)
+	 : "=d"(res), "=a"(src), "=d"(n)
+	 : "0"(res), "1"(src), "2"(n)
 	 : "d0");
     return res;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)