Go to the documentation of this file.
13 #include <linux/string.h>
14 #include <linux/module.h>
16 #ifdef __HAVE_ARCH_STRCPY
20 asm volatile(
"1:\tlodsb\n\t"
24 :
"=&S" (
d0),
"=&D" (d1),
"=&a" (
d2)
25 :
"0" (src),
"1" (
dest) :
"memory");
31 #ifdef __HAVE_ARCH_STRNCPY
35 asm volatile(
"1:\tdecl %2\n\t"
44 :
"=&S" (
d0),
"=&D" (d1),
"=&c" (
d2),
"=&a" (d3)
45 :
"0" (
src),
"1" (dest),
"2" (
count) :
"memory");
51 #ifdef __HAVE_ARCH_STRCAT
52 char *
strcat(
char *dest,
const char *src)
55 asm volatile(
"repne\n\t"
62 :
"=&S" (
d0),
"=&D" (d1),
"=&a" (
d2),
"=&c" (d3)
63 :
"0" (
src),
"1" (dest),
"2" (0),
"3" (0xffffffffu) :
"memory");
69 #ifdef __HAVE_ARCH_STRNCAT
70 char *
strncat(
char *dest,
const char *src,
size_t count)
73 asm volatile(
"repne\n\t"
85 :
"=&S" (
d0),
"=&D" (d1),
"=&a" (
d2),
"=&c" (d3)
86 :
"0" (
src),
"1" (dest),
"2" (0),
"3" (0xffffffffu),
"g" (
count)
93 #ifdef __HAVE_ARCH_STRCMP
98 asm volatile(
"1:\tlodsb\n\t"
101 "testb %%al,%%al\n\t"
103 "xorl %%eax,%%eax\n\t"
105 "2:\tsbbl %%eax,%%eax\n\t"
108 :
"=a" (
res),
"=&S" (d0),
"=&D" (
d1)
116 #ifdef __HAVE_ARCH_STRNCMP
117 int strncmp(
const char *cs,
const char *ct,
size_t count)
121 asm volatile(
"1:\tdecl %3\n\t"
126 "testb %%al,%%al\n\t"
128 "2:\txorl %%eax,%%eax\n\t"
130 "3:\tsbbl %%eax,%%eax\n\t"
133 :
"=a" (
res),
"=&S" (d0),
"=&D" (
d1),
"=&c" (d2)
134 :
"1" (
cs),
"2" (ct),
"3" (
count)
141 #ifdef __HAVE_ARCH_STRCHR
146 asm volatile(
"movb %%al,%%ah\n"
150 "testb %%al,%%al\n\t"
155 :
"=a" (
res),
"=&S" (d0)
163 #ifdef __HAVE_ARCH_STRLEN
164 size_t strlen(
const char *s)
168 asm volatile(
"repne\n\t"
170 :
"=c" (
res),
"=&D" (d0)
171 :
"1" (
s),
"a" (0),
"0" (0xffffffff
u)
178 #ifdef __HAVE_ARCH_MEMCHR
179 void *
memchr(
const void *cs,
int c,
size_t count)
185 asm volatile(
"repne\n\t"
190 :
"=D" (
res),
"=&c" (d0)
191 :
"a" (
c),
"0" (cs),
"1" (
count)
198 #ifdef __HAVE_ARCH_MEMSCAN
203 asm volatile(
"repnz; scasb\n\t"
207 :
"=D" (
addr),
"=c" (size)
208 :
"0" (
addr),
"1" (size),
"a" (
c)
215 #ifdef __HAVE_ARCH_STRNLEN
216 size_t strnlen(
const char *s,
size_t count)
220 asm volatile(
"movl %2,%0\n\t"
222 "1:\tcmpb $0,(%0)\n\t"
229 :
"=a" (
res),
"=&d" (d0)
230 :
"c" (
s),
"1" (count)