patch-2.3.35 linux/arch/sparc64/lib/strlen_user.S

Next file: linux/arch/sparc64/math-emu/math.c
Previous file: linux/arch/sparc64/lib/blockops.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.34/linux/arch/sparc64/lib/strlen_user.S linux/arch/sparc64/lib/strlen_user.S
@@ -4,7 +4,7 @@
  * or 0 for error
  *
  * Copyright (C) 1991,1996 Free Software Foundation
- * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1996,1999 David S. Miller (davem@redhat.com)
  * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  */
 
@@ -14,8 +14,11 @@
 #define HI_MAGIC 0x80808080
 
 	.align 4
-	.global __strlen_user
+	.global __strlen_user, __strnlen_user
 __strlen_user:
+	sethi	%hi(32768), %o1
+__strnlen_user:	
+	mov	%o1, %g1
 	mov	%o0, %o1
 	andcc	%o0, 3, %g0
 	be,pt	%icc, 9f
@@ -42,11 +45,16 @@
 13:	lda	[%o0] %asi, %o5
 2:	sub	%o5, %o2, %o4
 	andcc	%o4, %o3, %g0
-	be,pt	%icc, 13b
+	bne,pn	%icc, 82f
 	 add	%o0, 4, %o0
+	sub	%o0, %o1, %g2
+81:	cmp	%g2, %g1
+	blu,pt	%icc, 13b
+	 mov	%o0, %o4
+	ba,a,pt	%xcc, 1f
 
 	/* Check every byte. */
-	srl	%o5, 24, %g5
+82:	srl	%o5, 24, %g5
 	andcc	%g5, 0xff, %g0
 	be,pn	%icc, 1f
 	 add	%o0, -3, %o4
@@ -59,8 +67,8 @@
 	be,pn	%icc, 1f
 	 add	%o4, 1, %o4
 	andcc	%o5, 0xff, %g0
-	bne,a,pt %icc, 2b
-14:	 lda	[%o0] %asi, %o5
+	bne,pt	%icc, 81b
+	 sub	%o0, %o1, %g2
 	add	%o4, 1, %o4
 1:	retl
 	 sub	%o4, %o1, %o0
@@ -85,4 +93,3 @@
 	.word	12b, 30b
 	.word	15b, 30b
 	.word	13b, 30b
-	.word	14b, 30b

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