[PATCH] invalid asm in strnlen_user() (2.3.18ac, 2.2.13pre & gcc 2.95)

Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Thu, 16 Sep 1999 13:20:22 +0400


Hi, Alan!

This fixes compilation failure with gcc >= 2.95 on i386.
Diff is against 2.3.18ac, but could be applied to 2.2.13pre
as well.
[Bonus for gcc 2.7.2: it generates more compact code (3 insns less :-)]

Ivan.

--- 2.3.18ac5/arch/i386/lib/usercopy.c Tue Sep 14 21:06:53 1999
+++ linux/arch/i386/lib/usercopy.c Thu Sep 16 12:30:46 1999
@@ -155,7 +155,7 @@
long strnlen_user(const char *s, long n)
{
unsigned long mask = -__addr_ok(s);
- unsigned long res;
+ unsigned long res, tmp;

__asm__ __volatile__(
" andl %0,%%ecx\n"
@@ -172,8 +172,8 @@
" .align 4\n"
" .long 0b,2b\n"
".previous"
- :"=r" (n), "=D" (s), "=a" (res)
- :"0" (n), "1" (s), "2" (0), "c" (mask)
- :"cx", "cc");
+ :"=r" (n), "=D" (s), "=a" (res), "=c" (tmp)
+ :"0" (n), "1" (s), "2" (0), "3" (mask)
+ :"cc");
return res & mask;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/