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"
"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"
"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;
}
This asm has some serious problems. Any attempt to fix the compiler
to be more strict with how it uses registers which are clobbered by
the asm is going to lead to problems.
Note that cx and si are mentioned in both the input and clobber
list. This is wrong. You've set up a case where the inputs
and clobbers must be in the same register. This can't work and
is just going to cause problems.
I'm not an x86 hacker, so it's not really clear to me how you
would rewrite that asm. But it's clearly going to need to be
rewritten. And until it is, I can't do much on the compiler
side as I don't have a valid testcase.
jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu