patch-2.4.4 linux/include/asm-s390/checksum.h
Next file: linux/include/asm-s390/cpcmd.h
Previous file: linux/include/asm-s390/chandev.h
Back to the patch index
Back to the overall index
- Lines: 94
- Date:
Wed Apr 11 19:02:28 2001
- Orig file:
v2.4.3/linux/include/asm-s390/checksum.h
- Orig date:
Tue Feb 13 14:13:44 2001
diff -u --recursive --new-file v2.4.3/linux/include/asm-s390/checksum.h linux/include/asm-s390/checksum.h
@@ -36,14 +36,14 @@
extern inline unsigned int
csum_partial_inline(const unsigned char * buff, int len, unsigned int sum)
{
+ register_pair rp;
+
+ rp.subreg.even = (unsigned long) buff;
+ rp.subreg.odd = (unsigned long) len;
__asm__ __volatile__ (
- " lr 2,%1\n" /* address in gpr 2 */
- " lr 3,%2\n" /* length in gpr 3 */
- "0: cksm %0,2\n" /* do checksum on longs */
+ "0: cksm %0,%1\n" /* do checksum on longs */
" jo 0b\n"
- : "+&d" (sum)
- : "d" (buff), "d" (len)
- : "cc", "2", "3" );
+ : "+&d" (sum), "+&a" (rp) : : "cc" );
return sum;
}
@@ -97,14 +97,16 @@
extern inline unsigned short
csum_fold(unsigned int sum)
{
+ register_pair rp;
+
__asm__ __volatile__ (
- " sr 3,3\n" /* %0 = H*65536 + L */
- " lr 2,%0\n" /* %0 = H L, R2/R3 = H L / 0 0 */
- " srdl 2,16\n" /* %0 = H L, R2/R3 = 0 H / L 0 */
- " alr 2,3\n" /* %0 = H L, R2/R3 = L H / L 0 */
- " alr %0,2\n" /* %0 = H+L+C L+H */
- " srl %0,16\n" /* %0 = H+L+C */
- : "+&d" (sum) : : "cc", "2", "3");
+ " slr %N1,%N1\n" /* %0 = H L */
+ " lr %1,%0\n" /* %0 = H L, %1 = H L 0 0 */
+ " srdl %1,16\n" /* %0 = H L, %1 = 0 H L 0 */
+ " alr %1,%N1\n" /* %0 = H L, %1 = L H L 0 */
+ " alr %0,%1\n" /* %0 = H+L+C L+H */
+ " srl %0,16\n" /* %0 = H+L+C */
+ : "+&d" (sum), "=d" (rp) : : "cc" );
return ((unsigned short) ~sum);
}
#endif
@@ -117,17 +119,16 @@
extern inline unsigned short
ip_fast_csum(unsigned char *iph, unsigned int ihl)
{
+ register_pair rp;
unsigned long sum;
+ rp.subreg.even = (unsigned long) iph;
+ rp.subreg.odd = (unsigned long) ihl*4;
__asm__ __volatile__ (
" sr %0,%0\n" /* set sum to zero */
- " lr 2,%1\n" /* address in gpr 2 */
- " lr 3,%2\n" /* length in gpr 3 */
- "0: cksm %0,2\n" /* do checksum on longs */
+ "0: cksm %0,%1\n" /* do checksum on longs */
" jo 0b\n"
- : "=&d" (sum)
- : "d" (iph), "d" (ihl*4)
- : "cc", "2", "3" );
+ : "=&d" (sum), "+&a" (rp) : : "cc" );
return csum_fold(sum);
}
@@ -144,16 +145,21 @@
" alr %0,%1\n" /* sum += saddr */
" brc 12,0f\n"
" ahi %0,1\n" /* add carry */
- "0: alr %0,%2\n" /* sum += daddr */
+ "0:"
+ : "+&d" (sum) : "d" (saddr) : "cc" );
+ __asm__ __volatile__ (
+ " alr %0,%1\n" /* sum += daddr */
" brc 12,1f\n"
" ahi %0,1\n" /* add carry */
- "1: alr %0,%3\n" /* sum += (len<<16) + (proto<<8) */
+ "1:"
+ : "+&d" (sum) : "d" (daddr) : "cc" );
+ __asm__ __volatile__ (
+ " alr %0,%1\n" /* sum += (len<<16) + (proto<<8) */
" brc 12,2f\n"
" ahi %0,1\n" /* add carry */
"2:"
: "+&d" (sum)
- : "d" (saddr), "d" (daddr),
- "d" (((unsigned int) len<<16) + (unsigned int) proto)
+ : "d" (((unsigned int) len<<16) + (unsigned int) proto)
: "cc" );
return sum;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)