lkml.org 
[lkml]   [1998]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectPartial patch for checksum.c / egcs...
Date
From
Appended is a partial patch for checksum.c and egcs.  It works
with 686. It doesn't even compile for non-686. Egcs swears there
are more than ten asm operands in csum_partial_copy_generic. For
the life of me, I count only eight. Sure enough, if I remove one,
it compiles (and is broken).

Oh hell. I forgot that + isn't known by 2.7.2*. ARGH. This
doesn't work with the supported kernel compiler. I'll still send
this to poke people into looking at it. ;) I don't see an easy
way to stay under ten operands and do what seems to be the right
thing.

The portion of this patch that applies to csum_partial should be
correct. I tested that separately for 686 and 386, and it compiles
with both versions.

Jason, gcc __asm__ neophyte...

--- fresh/linux/arch/i386/lib/checksum.c Mon Sep 14 22:52:10 1998
+++ linux/arch/i386/lib/checksum.c Thu Dec 10 23:48:54 1998
@@ -102,15 +102,15 @@
6: addl %%ecx,%%eax
adcl $0, %%eax
7: "
- : "=a"(sum)
- : "0"(sum), "c"(len), "S"(buff)
- : "bx", "dx", "si", "cx", "memory");
+ : "=a"(sum), "=c"(len), "=S"(buff)
+ : "0"(sum), "1"(len), "2"(buff)
+ : "bx", "dx", "memory");
return(sum);
}

#else /* 686 */

-unsigned int csum_partial(const unsigned char * buf, int len, unsigned int sum) {
+unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) {
__asm__ ("
testl $2, %%esi
jnz 30f
@@ -195,9 +195,9 @@
addl %%ebx,%%eax
adcl $0,%%eax
80: "
- : "=a"(sum)
- : "0"(sum), "c"(len), "S"(buf)
- : "bx", "dx", "cx", "si", "memory");
+ : "=a"(sum), "=c"(len), "=S"(buff)
+ : "0"(sum), "1"(len), "2"(buff)
+ : "bx", "dx", "memory");
return(sum);
}

@@ -234,7 +234,7 @@
__u32 tmp_var;

__asm__ __volatile__ ( "
- movl %6,%%edi
+ movl %2,%%edi
testl $2, %%edi # Check alignment.
jz 2f # Jump if alignment is ok.
subl $2, %%ecx # Alignment uses up two bytes.
@@ -248,7 +248,7 @@
addw %%bx, %%ax
adcl $0, %%eax
2:
- movl %%ecx, %8
+ movl %%ecx, %6
shrl $5, %%ecx
jz 2f
testl %%esi, %%esi
@@ -285,7 +285,7 @@
dec %%ecx
jne 1b
adcl $0, %%eax
- 2: movl %8, %%edx
+ 2: movl %6, %%edx
movl %%edx, %%ecx
andl $0x1c, %%edx
je 4f
@@ -323,23 +323,23 @@
#
6000: #
#
- movl %7, (%%ebx) #
+ movl %5, (%%ebx) #
#
# zero the complete destination - computing the rest
# is too much work
- movl %6, %%edi
- movl %9, %%ecx
+ movl %2, %%edi
+ movl %7, %%ecx
xorl %%eax,%%eax
rep ; stosb
#
jmp 5000b #
#
6001: #
- movl %1, %%ebx #
+ movl %3, %%ebx #
jmp 6000b #
#
6002: #
- movl %2, %%ebx #
+ movl %4, %%ebx #
jmp 6000b #
#
.previous #
@@ -347,12 +347,11 @@
################################################

"
- : "=a" (sum)
+ : "+a"(sum), "+S"(src), "+D"(dst)
: "m" (src_err_ptr), "m" (dst_err_ptr),
- "0" (sum), "c" (len), "S" (src), "m" (dst),
- "i" (-EFAULT), "m"(tmp_var),
- "m" (len)
- : "bx", "dx", "si", "di", "cx", "memory" );
+ "i" (-EFAULT), "m"(tmp_var),
+ "m"(len)
+ : "bx", "cx", "dx", "memory" );

return(sum);
}
@@ -373,7 +372,7 @@
int len, int sum, int *src_err_ptr, int *dst_err_ptr)
{
__asm__ __volatile__ ("
- movl %4,%%ecx
+ movl %5,%%ecx
movl %%ecx, %%edx
movl %%ecx, %%ebx
shrl $6, %%ecx
@@ -409,25 +408,25 @@
adcl $0, %%eax
7:
.section .fixup, \"ax\"
-6000: movl %7, (%%ebx)
+6000: movl %6, (%%ebx)
# zero the complete destination (computing the rest is too much work)
- movl %8,%%edi
- movl %4,%%ecx
+ movl %2,%%edi
+ movl %5,%%ecx
xorl %%eax,%%eax
rep ; stosb
jmp 7b
-6001: movl %1, %%ebx
+6001: movl %3, %%ebx
jmp 6000b
-6002: movl %2, %%ebx
+6002: movl %4, %%ebx
jmp 6000b
.previous
"
- : "=a"(sum)
- : "m"(src_err_ptr), "m"(dst_err_ptr),
- "0"(sum), "m"(len), "S"(src), "D" (dst),
- "i" (-EFAULT),
- "m" (dst)
- : "bx", "cx", "si", "di", "dx", "memory" );
+ : "+a"(sum), "+S"(src), "+D"(dst)
+ : "m"(src_err_ptr), "m"(dst_err_ptr),
+ "m"(len),
+ "i"(-EFAULT)
+ : "bx", "cx", "dx", "memory" );
+
return(sum);
}

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.360 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site