patch-2.3.21 linux/include/asm-i386/string-486.h

Next file: linux/include/asm-i386/string.h
Previous file: linux/include/asm-i386/page.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.20/linux/include/asm-i386/string-486.h linux/include/asm-i386/string-486.h
@@ -14,6 +14,8 @@
  *		1994/03/15 by Alberto Vignani/Davide Parodi @crf.it
  *
  *	Split into 2 CPU specific files by Alan Cox to keep #ifdef noise down.
+ *
+ *	99/9/15  Proper reg args for newer gcc/egcs - Petkan (petkan@spct.net)
  */
 
 #define __HAVE_ARCH_STRCPY
@@ -180,6 +182,7 @@
 #define __HAVE_ARCH_STRRCHR
 extern inline char * strrchr(const char * s, int c)
 {
+int	d0, d1;
 register char * __res;
 __asm__ __volatile__(
 	"cld\n\t"
@@ -190,17 +193,19 @@
 	"leal -1(%%esi),%0\n"
 	"2:\ttestb %%al,%%al\n\t"
 	"jne 1b"
-	:"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
+	:"=d" (__res), "=&S" (d0), "=&a" (d1)
+	:"0" (0), "1" (s), "2" (c));
 return __res;
 }
 
 #define __HAVE_ARCH_STRSPN
 extern inline size_t strspn(const char * cs, const char * ct)
 {
+int	d0, d1;
 register char * __res;
 __asm__ __volatile__(
 	"cld\n\t"
-	"movl %4,%%edi\n\t"
+	"movl %6,%%edi\n\t"
 	"repne\n\t"
 	"scasb\n\t"
 	"notl %%ecx\n\t"
@@ -209,24 +214,26 @@
 	"1:\tlodsb\n\t"
 	"testb %%al,%%al\n\t"
 	"je 2f\n\t"
-	"movl %4,%%edi\n\t"
+	"movl %6,%%edi\n\t"
 	"movl %%edx,%%ecx\n\t"
 	"repne\n\t"
 	"scasb\n\t"
 	"je 1b\n"
 	"2:\tdecl %0"
-	:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
-	:"ax","cx","dx","di");
+	:"=S" (__res), "=&a" (d0), "=&c" (d1)
+	:"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct)
+	:"dx", "di");
 return __res-cs;
 }
 
 #define __HAVE_ARCH_STRCSPN
 extern inline size_t strcspn(const char * cs, const char * ct)
 {
+int	d0, d1;
 register char * __res;
 __asm__ __volatile__(
 	"cld\n\t"
-	"movl %4,%%edi\n\t"
+	"movl %6,%%edi\n\t"
 	"repne\n\t"
 	"scasb\n\t"
 	"notl %%ecx\n\t"
@@ -235,20 +242,22 @@
 	"1:\tlodsb\n\t"
 	"testb %%al,%%al\n\t"
 	"je 2f\n\t"
-	"movl %4,%%edi\n\t"
+	"movl %6,%%edi\n\t"
 	"movl %%edx,%%ecx\n\t"
 	"repne\n\t"
 	"scasb\n\t"
 	"jne 1b\n"
 	"2:\tdecl %0"
-	:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
-	:"ax","cx","dx","di");
+	:"=S" (__res), "=&a" (d0), "=&c" (d1)
+	:"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct)
+	:"dx", "di");
 return __res-cs;
 }
 
 #define __HAVE_ARCH_STRPBRK
 extern inline char * strpbrk(const char * cs,const char * ct)
 {
+int	d0, d1;
 register char * __res;
 __asm__ __volatile__(
 	"cld\n\t"
@@ -270,14 +279,16 @@
 	"jmp 3f\n"
 	"2:\txorl %0,%0\n"
 	"3:"
-	:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
-	:"ax","cx","dx","di");
+	:"=S" (__res), "=&a" (d0), "=&c" (d1)
+	:"0" (cs), "1" (0), "2" (0xffffffff), "g" (ct)
+	:"dx", "di");
 return __res;
 }
 
 #define __HAVE_ARCH_STRSTR
 extern inline char * strstr(const char * cs,const char * ct)
 {
+int	d0, d1;
 register char * __res;
 __asm__ __volatile__(
 	"cld\n\t" \
@@ -299,8 +310,9 @@
 	"jne 1b\n\t"
 	"xorl %%eax,%%eax\n\t"
 	"2:"
-	:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
-	:"cx","dx","di","si");
+	:"=a" (__res), "=&c" (d0), "=&S" (d1)
+	:"0" (0), "1" (0xffffffff), "2" (cs), "g" (ct)
+	:"dx", "di");
 return __res;
 }
 
@@ -328,6 +340,7 @@
 #define __HAVE_ARCH_STRNLEN
 extern inline size_t strnlen(const char * s, size_t count)
 {
+int	d0;
 register int __res;
 __asm__ __volatile__(
 	"movl %1,%0\n\t"
@@ -339,9 +352,8 @@
 	"cmpl $-1,%2\n\t"
 	"jne 1b\n"
 	"3:\tsubl %1,%0"
-	:"=a" (__res)
-	:"c" (s),"d" (count)
-	:"dx");
+	:"=a" (__res), "=&d" (d0)
+	:"1" (count), "c" (s));
 return __res;
 }
 /* end of additional stuff */
@@ -464,6 +476,7 @@
 
 extern inline void * __memcpy_g(void * to, const void * from, size_t n)
 {
+int	d0, d1, d2;
 register void *tmp = (void *)to;
 __asm__ __volatile__ (
 	"cld\n\t"
@@ -475,9 +488,9 @@
 	"movsw\n"
 	"2:\trep\n\t"
 	"movsl"
-	: /* no output */
-	:"c" (n),"D" ((long) tmp),"S" ((long) from)
-	:"cx","di","si","memory");
+	:"=&c" (d0), "=&D" (d1), "=&S" (d2)
+	:"0" (n), "1" ((long) tmp), "2" ((long) from)
+	:"memory");
 return (to);
 }
 
@@ -485,29 +498,31 @@
 #define __HAVE_ARCH_MEMMOVE
 extern inline void * memmove(void * dest,const void * src, size_t n)
 {
+int	d0, d1, d2;
 register void *tmp = (void *)dest;
 if (dest<src)
 __asm__ __volatile__ (
 	"cld\n\t"
 	"rep\n\t"
 	"movsb"
-	: /* no output */
-	:"c" (n),"S" (src),"D" (tmp)
-	:"cx","si","di");
+	:"=&c" (d0), "=&S" (d1), "=&D" (d2)
+	:"0" (n), "1" (src), "2" (tmp)
+	:"memory");
 else
 __asm__ __volatile__ (
 	"std\n\t"
 	"rep\n\t"
 	"movsb\n\t"
 	"cld"
-	: /* no output */
-	:"c" (n), "S" (n-1+(const char *)src), "D" (n-1+(char *)tmp)
-	:"cx","si","di","memory");
+	:"=&c" (d0), "=&S" (d1), "=&D" (d2)
+	:"0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)tmp)
+	:"memory");
 return dest;
 }
 
 extern inline int memcmp(const void * cs,const void * ct,size_t count)
 {
+int	d0, d1, d2;
 register int __res;
 __asm__ __volatile__(
 	"cld\n\t"
@@ -517,14 +532,15 @@
 	"sbbl %0,%0\n\t"
 	"orb $1,%b0\n"
 	"1:"
-	:"=abd" (__res):"0" (0),"S" (cs),"D" (ct),"c" (count)
-	:"si","di","cx");
+	:"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2)
+	:"0" (0), "1" (cs), "2" (ct), "3" (count));
 return __res;
 }
 
 #define __HAVE_ARCH_MEMCHR
 extern inline void * memchr(const void * cs,int c,size_t count)
 {
+int	d0;
 register void * __res;
 if (!count)
 	return NULL;
@@ -535,8 +551,8 @@
 	"je 1f\n\t"
 	"movl $1,%0\n"
 	"1:\tdecl %0"
-	:"=D" (__res):"a" (c),"D" (cs),"c" (count)
-	:"cx");
+	:"=D" (__res), "=&c" (d0)
+	:"a" (c), "0" (cs), "1" (count));
 return __res;
 }
 
@@ -643,6 +659,7 @@
 
 extern inline void * __memset_cg(void * s, char c, size_t count)
 {
+int	d0, d1;
 register void *tmp = (void *)s;
 __asm__ __volatile__ (
 	"shrl $1,%%ecx\n\t"
@@ -651,14 +668,15 @@
 	"jnc 1f\n\t"
 	"movb %%al,(%%edi)\n"
 	"1:"
-	: /* no output */
-	:"c" (count),"D" (tmp), "a" (0x0101U * (unsigned char) c)
-	:"cx","di","memory");
+	:"=&c" (d0), "=&D" (d1) 
+	:"a" (0x0101U * (unsigned char) c), "0" (count), "1" (tmp)
+	:"memory");
 return s;
 }
 
 extern inline void * __memset_gg(void * s,char c,size_t count)
 {
+int	d0, d1, d2;
 register void *tmp = (void *)s;
 __asm__ __volatile__ (
 	"movb %%al,%%ah\n\t"
@@ -668,9 +686,9 @@
 	"jnc 1f\n\t"
 	"movb %%al,(%%edi)\n"
 	"1:"
-	: /* no output */
-	:"c" (count),"D" (tmp), "a" (c)
-	:"cx","di","memory");
+	:"=&c" (d0), "=&D" (d1), "=&D" (d2)
+	:"0" (count), "1" (tmp), "2" (c)
+	:"memory");
 return s;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)