patch-2.4.4 linux/arch/s390/lib/checksum.c
Next file: linux/arch/s390/lib/misaligned.c
Previous file: linux/arch/s390/lib/Makefile
Back to the patch index
Back to the overall index
- Lines: 50
- Date:
Wed Apr 11 19:02:28 2001
- Orig file:
v2.4.3/linux/arch/s390/lib/checksum.c
- Orig date:
Fri May 12 11:41:45 2000
diff -u --recursive --new-file v2.4.3/linux/arch/s390/lib/checksum.c linux/arch/s390/lib/checksum.c
@@ -23,18 +23,17 @@
unsigned int
csum_partial (const unsigned char *buff, int len, unsigned int sum)
{
+ register_pair rp;
/*
* Experiments with ethernet and slip connections show that buff
* is aligned on either a 2-byte or 4-byte boundary.
*/
+ 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;
}
@@ -43,14 +42,16 @@
*/
unsigned short csum_fold(unsigned int sum)
{
- __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");
- return ((unsigned short) ~sum);
+ register_pair rp;
+
+ __asm__ __volatile__ (
+ " 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);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)