[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Kernel string implementation I386.
hi all,
In the code below, which is string implementation of Linux Kernel,
Why the dummy variables are updated.
#define __HAVE_ARCH_STRCPY
static inline char * strcpy(char * dest,const char *src)
{
int d0, d1, d2;
__asm__ __volatile__(
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
: "=&S" (d0), "=&D" (d1), "=&a" (d2)
:"0" (src),"1" (dest) : "memory");
return dest;
}
So, What's wrong with this,
static inline char * strcpy(char * dest,const char *src)
{
__asm__ __volatile__(
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
:"0" (src),"1" (dest) : "memory");
return dest;
}
thanks in advance
Manish Regmi
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/