Blame view
arch/x86/lib/strstr_32.c
674 Bytes
1da177e4c Linux-2.6.12-rc2 |
1 |
#include <linux/string.h> |
f73920cd6 x86: coding style... |
2 |
char *strstr(const char *cs, const char *ct) |
1da177e4c Linux-2.6.12-rc2 |
3 4 |
{ int d0, d1; |
f73920cd6 x86: coding style... |
5 |
register char *__res; |
1da177e4c Linux-2.6.12-rc2 |
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
__asm__ __volatile__( "movl %6,%%edi \t" "repne \t" "scasb \t" "notl %%ecx \t" "decl %%ecx \t" /* NOTE! This also sets Z if searchstring='' */ "movl %%ecx,%%edx " "1:\tmovl %6,%%edi \t" "movl %%esi,%%eax \t" "movl %%edx,%%ecx \t" "repe \t" "cmpsb \t" "je 2f \t" /* also works for empty string, see above */ "xchgl %%eax,%%esi \t" "incl %%esi \t" "cmpb $0,-1(%%eax) \t" "jne 1b \t" "xorl %%eax,%%eax \t" "2:" |
209b580fd x86: coding style... |
42 43 44 |
: "=a" (__res), "=&c" (d0), "=&S" (d1) : "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct) : "dx", "di"); |
1da177e4c Linux-2.6.12-rc2 |
45 46 |
return __res; } |