This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
glibc-2.0.93: inlines for strstr on i486 badly broken
- To: libc-alpha@cygnus.com
- Subject: glibc-2.0.93: inlines for strstr on i486 badly broken
- From: Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
- Date: Tue, 19 May 1998 23:01:19 -0400
The string inlines for __strstr_g() are missing the initialization of %edi
to __needle, so every use of them segfaults. There are also unnecesary
initial values for the fourth argument.
--- glibc-2.0.93/sysdeps/i386/i486/bits/string.h.dist Fri May 8 14:47:42 1998
+++ glibc-2.0.93/sysdeps/i386/i486/bits/string.h Tue May 19 22:50:29 1998
@@ -1512,6 +1512,7 @@
register char *__res;
__asm__ __volatile__
("cld\n\t"
+ "movl %%edx,%%edi\n\t"
"repne; scasb\n\t"
"notl %%ecx\n\t"
"pushl %%ebx\n\t"
@@ -1530,7 +1531,7 @@
"2:\n\t"
"popl %%ebx"
: "=a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2)
- : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (0), "d" (__needle)
+ : "0" (0), "1" (0xffffffff), "2" (__haystack), "d" (__needle)
: "cc");
return __res;
}
@@ -1542,6 +1543,7 @@
register char *__res;
__asm__ __volatile__
("cld\n\t"
+ "movl %%ebx,%%edi\n\t"
"repne; scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
@@ -1558,12 +1560,11 @@
"xorl %%eax,%%eax\n"
"2:"
: "=a" (__res), "=&c" (__d0), "=&S" (__d1), "=&D" (__d2), "=&d" (__d3)
- : "0" (0), "1" (0xffffffff), "2" (__haystack), "3" (0), "b" (__needle)
+ : "0" (0), "1" (0xffffffff), "2" (__haystack), "b" (__needle)
: "cc");
return __res;
}
#endif
#undef __STRING_INLINE
--
Horst von Brand vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile +56 32 672616