This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] REPOST: ARM big-endian strlen() fix


The attached patch fixes strlen() on big-endian ARM. Please apply.
Thanks.
-- 
Krzysztof Halasa, B*FH
--- glibc-2.3.3.old/sysdeps/arm/strlen.S	2003-04-30 00:47:20.000000000 +0200
+++ glibc-2.3.3/sysdeps/arm/strlen.S	2004-06-06 03:21:48.351931240 +0200
@@ -53,12 +53,21 @@
 	ldrne   r2, [r1], $4            @ and we continue to the next word
 	bne     Laligned                @
 Llastword:				@ drop through to here once we find a
+#ifdef __ARMEB__
+	tst     r2, $0xff000000         @ word that has a zero byte in it
+	addne   r0, r0, $1              @
+	tstne   r2, $0x00ff0000         @ and add up to 3 bytes on to it
+	addne   r0, r0, $1              @
+	tstne   r2, $0x0000ff00         @ (if first three all non-zero, 4th
+	addne   r0, r0, $1              @  must be zero)
+#else
 	tst     r2, $0x000000ff         @ word that has a zero byte in it
 	addne   r0, r0, $1              @
 	tstne   r2, $0x0000ff00         @ and add up to 3 bytes on to it
 	addne   r0, r0, $1              @
 	tstne   r2, $0x00ff0000         @ (if first three all non-zero, 4th
 	addne   r0, r0, $1              @  must be zero)
+#endif
 	RETINSTR(mov,pc,lr)
 END(strlen)
 libc_hidden_builtin_def (strlen)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]