0001
0002 #include <linux/string.h>
0003 #include <linux/export.h>
0004
0005 char *strstr(const char *cs, const char *ct)
0006 {
0007 int d0, d1;
0008 register char *__res;
0009 __asm__ __volatile__(
0010 "movl %6,%%edi\n\t"
0011 "repne\n\t"
0012 "scasb\n\t"
0013 "notl %%ecx\n\t"
0014 "decl %%ecx\n\t"
0015 "movl %%ecx,%%edx\n"
0016 "1:\tmovl %6,%%edi\n\t"
0017 "movl %%esi,%%eax\n\t"
0018 "movl %%edx,%%ecx\n\t"
0019 "repe\n\t"
0020 "cmpsb\n\t"
0021 "je 2f\n\t"
0022 "xchgl %%eax,%%esi\n\t"
0023 "incl %%esi\n\t"
0024 "cmpb $0,-1(%%eax)\n\t"
0025 "jne 1b\n\t"
0026 "xorl %%eax,%%eax\n\t"
0027 "2:"
0028 : "=a" (__res), "=&c" (d0), "=&S" (d1)
0029 : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
0030 : "dx", "di");
0031 return __res;
0032 }
0033 EXPORT_SYMBOL(strstr);