• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2	.text
3/*
4 * This is a version of ip_compute_csum() optimized for IP headers,
5 * which always checksum on 4 octet boundaries.
6 *
7 * extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
8 *
9 */
10	.global _ip_fast_csum
11	.type   _ip_fast_csum,function
12_ip_fast_csum:
13	!! TXRPT needs loops - 1
14	SUBS	TXRPT,D0Ar2,#1
15	MOV	D0Re0,#0
16	BLO	$Lfast_csum_exit
17$Lfast_csum_loop:
18	GETD	D1Ar3,[D1Ar1++]
19	ADDS	D0Re0,D0Re0,D1Ar3
20	ADDCS   D0Re0,D0Re0,#1
21	BR	$Lfast_csum_loop
22	LSR	D0Ar4,D0Re0,#16
23	AND	D0Re0,D0Re0,#0xffff
24	AND	D0Ar4,D0Ar4,#0xffff
25	ADD	D0Re0,D0Re0,D0Ar4
26	LSR	D0Ar4,D0Re0,#16
27	ADD	D0Re0,D0Re0,D0Ar4
28	XOR	D0Re0,D0Re0,#-1
29	AND	D0Re0,D0Re0,#0xffff
30$Lfast_csum_exit:
31	MOV	PC,D1RtP
32	.size _ip_fast_csum,.-_ip_fast_csum
33