patch-2.0.21-2.1.0 linux/arch/i386/lib/checksum.c
Next file: linux/arch/i386/math-emu/fpu_emu.h
Previous file: linux/arch/i386/kernel/vm86.c
Back to the patch index
Back to the overall index
- Lines: 102
- Date:
Mon Sep 23 11:26:30 1996
- Orig file:
lx2.0/v2.0.21/linux/arch/i386/lib/checksum.c
- Orig date:
Wed Sep 27 09:57:18 1995
diff -u --recursive --new-file lx2.0/v2.0.21/linux/arch/i386/lib/checksum.c linux/arch/i386/lib/checksum.c
@@ -98,101 +98,6 @@
/*
- * copy from fs while checksumming, otherwise like csum_partial
- */
-
-unsigned int csum_partial_copy_fromuser(const char *src, char *dst,
- int len, int sum) {
- __asm__("
- testl $2, %%edi # Check alignment.
- jz 2f # Jump if alignment is ok.
- subl $2, %%ecx # Alignment uses up two bytes.
- jae 1f # Jump if we had at least two bytes.
- addl $2, %%ecx # ecx was < 2. Deal with it.
- jmp 4f
-1: movw %%fs:(%%esi), %%bx
- addl $2, %%esi
- movw %%bx, (%%edi)
- addl $2, %%edi
- addw %%bx, %%ax
- adcl $0, %%eax
-2:
- movl %%ecx, %%edx
- shrl $5, %%ecx
- jz 2f
- testl %%esi, %%esi
-1: movl %%fs:(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, (%%edi)
-
- movl %%fs:4(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 4(%%edi)
-
- movl %%fs:8(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 8(%%edi)
-
- movl %%fs:12(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 12(%%edi)
-
- movl %%fs:16(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 16(%%edi)
-
- movl %%fs:20(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 20(%%edi)
-
- movl %%fs:24(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 24(%%edi)
-
- movl %%fs:28(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, 28(%%edi)
-
- lea 32(%%esi), %%esi
- lea 32(%%edi), %%edi
- dec %%ecx
- jne 1b
- adcl $0, %%eax
-2: movl %%edx, %%ecx
- andl $28, %%edx
- je 4f
- shrl $2, %%edx
- testl %%esi, %%esi
-3: movl %%fs:(%%esi), %%ebx
- adcl %%ebx, %%eax
- movl %%ebx, (%%edi)
- lea 4(%%esi), %%esi
- lea 4(%%edi), %%edi
- dec %%edx
- jne 3b
- adcl $0, %%eax
-4: andl $3, %%ecx
- jz 7f
- cmpl $2, %%ecx
- jb 5f
- movw %%fs:(%%esi), %%cx
- leal 2(%%esi), %%esi
- movw %%cx, (%%edi)
- leal 2(%%edi), %%edi
- je 6f
- shll $16,%%ecx
-5: movb %%fs:(%%esi), %%cl
- movb %%cl, (%%edi)
-6: addl %%ecx, %%eax
- adcl $0, %%eax
-7:
- "
- : "=a" (sum)
- : "0"(sum), "c"(len), "S"(src), "D" (dst)
- : "bx", "cx", "dx", "si", "di" );
- return(sum);
-}
-/*
* copy from ds while checksumming, otherwise like csum_partial
*/
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov