1 --- dip-3.3.7o/command.c.orig Thu Jan 21 15:37:13 1999
2 +++ dip-3.3.7o/command.c Thu Jan 21 15:45:04 1999
4 return((~sum) & 0xffff);
7 +#elif defined (__arm__)
10 + * This is a version of ip_compute_csum() optimized for IP headers,
11 + * which always checksum on 4 octet boundaries.
13 + * Converted and optimised for ARM by R. M. King.
15 + * Note: the order that the LDM registers are loaded with respect to
16 + * the adc's doesn't matter.
18 +static inline unsigned short
19 +ip_fast_csum(unsigned char * iph, unsigned int ihl)
21 + unsigned int sum, tmp1;
23 + __asm__ __volatile__("
38 + adds %0, %0, %0, lsl #16
39 + addcs %0, %0, #0x10000
43 + : "=&r" (sum), "=&r" (iph), "=&r" (ihl), "=&r" (tmp1)
44 + : "1" (iph), "2" (ihl));
49 + * Fold a partial checksum without adding pseudo headers
51 +static inline unsigned int
52 +csum_fold(unsigned int sum)
55 + adds %0, %0, %0, lsl #16
56 + addcs %0, %0, #0x10000"
59 + return (~sum) >> 16;
62 +static inline unsigned long
63 +csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
64 + unsigned short proto, unsigned int sum)
72 + : "r" (daddr), "r" (saddr), "r" ((ntohs(len)<<16)+proto*256), "0" (sum));
76 + * computes the checksum of the TCP/UDP pseudo-header
77 + * returns a 16-bit checksum, already complemented
79 +static inline unsigned short int
80 +csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
81 + unsigned short proto, unsigned int sum)
83 + return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
86 +static unsigned short
87 +udp_check(struct udphdr *uh, int len,
88 + unsigned long saddr, unsigned long daddr)
90 + return(csum_tcpudp_magic(saddr, daddr, len, IPPROTO_UDP, 0));
95 #error You need to write tcp/ip checksum routines for your architecture