patch-2.1.38 linux/include/asm-sparc64/checksum.h

Next file: linux/include/asm-sparc64/current.h
Previous file: linux/include/asm-sparc64/bitops.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.37/linux/include/asm-sparc64/checksum.h linux/include/asm-sparc64/checksum.h
@@ -1,4 +1,4 @@
-/* $Id: checksum.h,v 1.6 1997/04/10 23:32:43 davem Exp $ */
+/* $Id: checksum.h,v 1.7 1997/05/14 07:02:44 davem Exp $ */
 #ifndef __SPARC64_CHECKSUM_H
 #define __SPARC64_CHECKSUM_H
 
@@ -54,6 +54,7 @@
 	__asm__ __volatile__ ("
 		call __csum_partial_copy_sparc_generic
 		 mov %4, %%g7
+		srl	%%o0, 0, %%o0
 	" : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (sum) :
 	"o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7");
 	return (unsigned int)ret;
@@ -81,6 +82,7 @@
 1:
 		call __csum_partial_copy_sparc_generic
 		 stx %5, [%%sp + 0x7ff + 128]
+		srl	%%o0, 0, %%o0
 		" : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err) :
 		"o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7");
 		return (unsigned int)ret;
@@ -108,6 +110,7 @@
 1:
 		call __csum_partial_copy_sparc_generic
 		 stx %5, [%%sp + 0x7ff + 128]
+		srl	%%o0, 0, %%o0
 		" : "=r" (ret) : "0" (ret), "r" (d), "r" (l), "r" (s), "r" (err) :
 		"o1", "o2", "o3", "o4", "o5", "o7", "g1", "g2", "g3", "g5", "g7");
 		return (unsigned int)ret;
@@ -151,6 +154,7 @@
 	srl		%%g2, 16, %0
 	addc		%0, %%g0, %0
 	xnor		%%g0, %0, %0
+	srl		%0, 0, %0
 "	: "=r" (sum), "=&r" (iph)
 	: "r" (ihl), "1" (iph)
 	: "g2", "g3", "g7", "cc");
@@ -179,11 +183,11 @@
 "	: "=r" (sum), "=r" (saddr)
 	: "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr)
 	: "cc");
-	return sum;
+	return (sum & 0xffff);
 }
 
 /* Fold a partial checksum without adding pseudo headers. */
-extern __inline__ unsigned int csum_fold(unsigned int sum)
+extern __inline__ unsigned short csum_fold(unsigned int sum)
 {
 	unsigned int tmp;
 
@@ -195,7 +199,7 @@
 "	: "=&r" (sum), "=r" (tmp)
 	: "0" (sum), "1" (sum<<16)
 	: "cc");
-	return sum;
+	return (sum & 0xffff);
 }
 
 #define _HAVE_ARCH_IPV6_CSUM

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov