Blame view

kernel/linux-rt-4.4.41/arch/x86/lib/strstr_32.c 674 Bytes
5113f6f70   김현기   kernel add
1
2
3
4
5
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
42
43
44
45
46
47
  #include <linux/string.h>
  
  char *strstr(const char *cs, const char *ct)
  {
  int	d0, d1;
  register char *__res;
  __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:"
  	: "=a" (__res), "=&c" (d0), "=&S" (d1)
  	: "0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
  	: "dx", "di");
  return __res;
  }