lkml.org 
[lkml]   [1999]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Getting rid of inlined strstr.
Hi,
This patch removes the inlined strstr from the i386 architecture and uses
the C version already in lib/string.c (i386 was the only architecture to
use an inlined version of strstr - all other architectures use the C
version.)

diff -urN linux-2.2.0-pre8/arch/i386/kernel/i386_ksyms.c linux/arch/i386/kernel/i386_ksyms.c
--- linux-2.2.0-pre8/arch/i386/kernel/i386_ksyms.c Thu Jan 14 06:39:41 1999
+++ linux/arch/i386/kernel/i386_ksyms.c Wed Jan 20 08:50:08 1999
@@ -1,5 +1,6 @@
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/string.h>
#include <linux/smp.h>
#include <linux/user.h>
#include <linux/elfcore.h>
@@ -58,6 +59,7 @@
EXPORT_SYMBOL_NOVERS(__put_user_2);
EXPORT_SYMBOL_NOVERS(__put_user_4);

+EXPORT_SYMBOL(strstr);
EXPORT_SYMBOL(strtok);
EXPORT_SYMBOL(strpbrk);

diff -urN linux-2.2.0-pre8/drivers/pnp/parport_probe.c linux/drivers/pnp/parport_probe.c
--- linux-2.2.0-pre8/drivers/pnp/parport_probe.c Fri Jan 1 19:57:06 1999
+++ linux/drivers/pnp/parport_probe.c Wed Jan 20 09:18:07 1999
@@ -15,6 +15,7 @@
#include <linux/malloc.h>
#include <linux/ctype.h>
#include <linux/module.h>
+#include <linux/string.h>

#include <linux/lp.h>

diff -urN linux-2.2.0-pre8/include/asm-i386/string-486.h linux/include/asm-i386/string-486.h
--- linux-2.2.0-pre8/include/asm-i386/string-486.h Thu Feb 27 19:57:31 1997
+++ linux/include/asm-i386/string-486.h Wed Jan 20 08:42:04 1999
@@ -5,9 +5,9 @@
* This string-include defines all string functions as inline
* functions. Use gcc. It also assumes ds=es=data space, this should be
* normal. Most of the string-functions are rather heavily hand-optimized,
- * see especially strtok,strstr,str[c]spn. They should work, but are not
- * very easy to understand. Everything is done entirely within the register
- * set, making the functions fast and clean.
+ * see especially strtok,str[c]spn. They should work, but are not very
+ * easy to understand. Everything is done entirely within the register set,
+ * making the functions fast and clean.
*
* Copyright (C) 1991, 1992 Linus Torvalds
* Revised and optimized for i486/pentium
@@ -272,35 +272,6 @@
"3:"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
-return __res;
-}
-
-#define __HAVE_ARCH_STRSTR
-extern inline char * strstr(const char * cs,const char * ct)
-{
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t" \
- "movl %4,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
- "movl %%ecx,%%edx\n"
- "1:\tmovl %4,%%edi\n\t"
- "movl %%esi,%%eax\n\t"
- "movl %%edx,%%ecx\n\t"
- "repe\n\t"
- "cmpsb\n\t"
- "je 2f\n\t" /* also works for empty string, see above */
- "xchgl %%eax,%%esi\n\t"
- "incl %%esi\n\t"
- "cmpb $0,-1(%%eax)\n\t"
- "jne 1b\n\t"
- "xorl %%eax,%%eax\n\t"
- "2:"
- :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
- :"cx","dx","di","si");
return __res;
}

diff -urN linux-2.2.0-pre8/include/asm-i386/string.h linux/include/asm-i386/string.h
--- linux-2.2.0-pre8/include/asm-i386/string.h Tue Jan 19 07:40:17 1999
+++ linux/include/asm-i386/string.h Wed Jan 20 08:44:40 1999
@@ -18,10 +18,10 @@
* This string-include defines all string functions as inline
* functions. Use gcc. It also assumes ds=es=data space, this should be
* normal. Most of the string-functions are rather heavily hand-optimized,
- * see especially strtok,strstr,str[c]spn. They should work, but are not
- * very easy to understand. Everything is done entirely within the register
- * set, making the functions fast and clean. String instructions have been
- * used through-out, making for "slightly" unclear code :-)
+ * see especially strtok,str[c]spn. They should work, but are not very
+ * easy to understand. Everything is done entirely within the register set,
+ * making the functions fast and clean. String instructions have been used
+ * through-out, making for "slightly" unclear code :-)
*
* NO Copyright (C) 1991, 1992 Linus Torvalds,
* consider these trivial functions to be PD.
@@ -185,35 +185,6 @@
"2:\ttestb %%al,%%al\n\t"
"jne 1b"
:"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c));
-return __res;
-}
-
-#define __HAVE_ARCH_STRSTR
-extern inline char * strstr(const char * cs,const char * ct)
-{
-int d0, d1, d2, d3, d4;
-register char * __res;
-__asm__ __volatile__(
- "cld\n\t" \
- "movl %8,%%edi\n\t"
- "repne\n\t"
- "scasb\n\t"
- "notl %%ecx\n\t"
- "decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
- "movl %%ecx,%%edx\n"
- "1:\tmovl %8,%%edi\n\t"
- "movl %%esi,%%eax\n\t"
- "movl %%edx,%%ecx\n\t"
- "repe\n\t"
- "cmpsb\n\t"
- "je 2f\n\t" /* also works for empty string, see above */
- "xchgl %%eax,%%esi\n\t"
- "incl %%esi\n\t"
- "cmpb $0,-1(%%eax)\n\t"
- "jne 1b\n\t"
- "xorl %%eax,%%eax\n\t"
- "2:"
- :"=a" (__res), "=&c" (d0), "=&S" (d1), "=&d" (d2), "=&D" (d3), "=&g" (d4) : "0" (0),"1" (0xffffffff),"2" (cs),"4" (ct));
return __res;
}

--
Niels Kristian Bech Jensen -- nkbj@image.dk -- http://www.image.dk/~nkbj/
----------->> Stop software piracy --- use free software! <<-----------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.040 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site