Changeset 517660f1 in rtems
- Timestamp:
- 04/01/99 16:36:22 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- f72dd2a
- Parents:
- 5eb7da97
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/libnetworking/machine/in_cksum.h
r5eb7da97 r517660f1 159 159 160 160 /* 161 * SPARC Version 162 */ 163 164 #elif (defined(__GNUC__) && defined(sparc)) 165 166 static __inline u_int 167 in_cksum_hdr(const struct ip *ip) 168 { 169 register u_int sum = 0; 170 register u_int tmp_o2; 171 register u_int tmp_o3; 172 173 __asm__ volatile (" 174 ld [%0], %1 ; \ 175 ld [%0+4], %2 ; \ 176 addcc %1, %2, %1 ; \ 177 ld [%0+8], %2 ; \ 178 addxcc %1, %2, %1 ; \ 179 ld [%0+12], %2 ; \ 180 addxcc %1, %2, %1 ; \ 181 ld [%0+16], %2 ; \ 182 addxcc %1, %2, %1 ; \ 183 set 0x0ffff, %3 ; \ 184 srl %1, 16, %2 ; \ 185 and %1, %3, %1 ; \ 186 addx %1, %2, %1 ; \ 187 srl %1, 16, %1 ; \ 188 add %1, %%g0, %1 ; \ 189 neg %1 ; \ 190 and %1, %3, %1 ; \ 191 " : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3) 192 : "0" (ip), "1" (sum) 193 ); 194 return sum; 195 } 196 197 #define in_cksum_update(ip) \ 198 do { \ 199 int __tmpsum; \ 200 __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ 201 ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ 202 } while(0) 203 /* 161 204 * Here is the generic, portable, inefficient algorithm. 162 205 */ -
c/src/exec/libnetworking/rtems/rtems_glue.c
r5eb7da97 r517660f1 699 699 */ 700 700 701 #if (defined(__GNUC__) && defined(sparc))702 703 asm("704 .text705 .global _in_cksum_hdr706 _in_cksum_hdr:707 708 ld [%o0], %o1709 ld [%o0+4], %o2710 addcc %o1, %o2, %o1711 ld [%o0+8], %o2712 addxcc %o1, %o2, %o1713 ld [%o0+12], %o2714 addxcc %o1, %o2, %o1715 ld [%o0+16], %o2716 addxcc %o1, %o2, %o1717 set 0x0ffff, %o3718 srl %o1, 16, %o2719 and %o1, %o3, %o1720 addx %o1, %o2, %o1721 srl %o1, 16, %o1722 add %o1, %g0, %o1723 neg %o1724 retl725 and %o1, %o3, %o0726 727 ");728 #else729 730 701 u_int 731 702 in_cksum_hdr (const void *ip) … … 743 714 return ~sum & 0xFFFF; 744 715 } 745 746 #endif747 716 748 717 /* -
c/src/lib/libnetworking/machine/in_cksum.h
r5eb7da97 r517660f1 159 159 160 160 /* 161 * SPARC Version 162 */ 163 164 #elif (defined(__GNUC__) && defined(sparc)) 165 166 static __inline u_int 167 in_cksum_hdr(const struct ip *ip) 168 { 169 register u_int sum = 0; 170 register u_int tmp_o2; 171 register u_int tmp_o3; 172 173 __asm__ volatile (" 174 ld [%0], %1 ; \ 175 ld [%0+4], %2 ; \ 176 addcc %1, %2, %1 ; \ 177 ld [%0+8], %2 ; \ 178 addxcc %1, %2, %1 ; \ 179 ld [%0+12], %2 ; \ 180 addxcc %1, %2, %1 ; \ 181 ld [%0+16], %2 ; \ 182 addxcc %1, %2, %1 ; \ 183 set 0x0ffff, %3 ; \ 184 srl %1, 16, %2 ; \ 185 and %1, %3, %1 ; \ 186 addx %1, %2, %1 ; \ 187 srl %1, 16, %1 ; \ 188 add %1, %%g0, %1 ; \ 189 neg %1 ; \ 190 and %1, %3, %1 ; \ 191 " : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3) 192 : "0" (ip), "1" (sum) 193 ); 194 return sum; 195 } 196 197 #define in_cksum_update(ip) \ 198 do { \ 199 int __tmpsum; \ 200 __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ 201 ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ 202 } while(0) 203 /* 161 204 * Here is the generic, portable, inefficient algorithm. 162 205 */ -
c/src/lib/libnetworking/rtems/rtems_glue.c
r5eb7da97 r517660f1 699 699 */ 700 700 701 #if (defined(__GNUC__) && defined(sparc))702 703 asm("704 .text705 .global _in_cksum_hdr706 _in_cksum_hdr:707 708 ld [%o0], %o1709 ld [%o0+4], %o2710 addcc %o1, %o2, %o1711 ld [%o0+8], %o2712 addxcc %o1, %o2, %o1713 ld [%o0+12], %o2714 addxcc %o1, %o2, %o1715 ld [%o0+16], %o2716 addxcc %o1, %o2, %o1717 set 0x0ffff, %o3718 srl %o1, 16, %o2719 and %o1, %o3, %o1720 addx %o1, %o2, %o1721 srl %o1, 16, %o1722 add %o1, %g0, %o1723 neg %o1724 retl725 and %o1, %o3, %o0726 727 ");728 #else729 730 701 u_int 731 702 in_cksum_hdr (const void *ip) … … 743 714 return ~sum & 0xFFFF; 744 715 } 745 746 #endif747 716 748 717 /* -
c/src/libnetworking/machine/in_cksum.h
r5eb7da97 r517660f1 159 159 160 160 /* 161 * SPARC Version 162 */ 163 164 #elif (defined(__GNUC__) && defined(sparc)) 165 166 static __inline u_int 167 in_cksum_hdr(const struct ip *ip) 168 { 169 register u_int sum = 0; 170 register u_int tmp_o2; 171 register u_int tmp_o3; 172 173 __asm__ volatile (" 174 ld [%0], %1 ; \ 175 ld [%0+4], %2 ; \ 176 addcc %1, %2, %1 ; \ 177 ld [%0+8], %2 ; \ 178 addxcc %1, %2, %1 ; \ 179 ld [%0+12], %2 ; \ 180 addxcc %1, %2, %1 ; \ 181 ld [%0+16], %2 ; \ 182 addxcc %1, %2, %1 ; \ 183 set 0x0ffff, %3 ; \ 184 srl %1, 16, %2 ; \ 185 and %1, %3, %1 ; \ 186 addx %1, %2, %1 ; \ 187 srl %1, 16, %1 ; \ 188 add %1, %%g0, %1 ; \ 189 neg %1 ; \ 190 and %1, %3, %1 ; \ 191 " : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3) 192 : "0" (ip), "1" (sum) 193 ); 194 return sum; 195 } 196 197 #define in_cksum_update(ip) \ 198 do { \ 199 int __tmpsum; \ 200 __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ 201 ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ 202 } while(0) 203 /* 161 204 * Here is the generic, portable, inefficient algorithm. 162 205 */ -
c/src/libnetworking/rtems/rtems_glue.c
r5eb7da97 r517660f1 699 699 */ 700 700 701 #if (defined(__GNUC__) && defined(sparc))702 703 asm("704 .text705 .global _in_cksum_hdr706 _in_cksum_hdr:707 708 ld [%o0], %o1709 ld [%o0+4], %o2710 addcc %o1, %o2, %o1711 ld [%o0+8], %o2712 addxcc %o1, %o2, %o1713 ld [%o0+12], %o2714 addxcc %o1, %o2, %o1715 ld [%o0+16], %o2716 addxcc %o1, %o2, %o1717 set 0x0ffff, %o3718 srl %o1, 16, %o2719 and %o1, %o3, %o1720 addx %o1, %o2, %o1721 srl %o1, 16, %o1722 add %o1, %g0, %o1723 neg %o1724 retl725 and %o1, %o3, %o0726 727 ");728 #else729 730 701 u_int 731 702 in_cksum_hdr (const void *ip) … … 743 714 return ~sum & 0xFFFF; 744 715 } 745 746 #endif747 716 748 717 /* -
cpukit/libnetworking/machine/in_cksum.h
r5eb7da97 r517660f1 159 159 160 160 /* 161 * SPARC Version 162 */ 163 164 #elif (defined(__GNUC__) && defined(sparc)) 165 166 static __inline u_int 167 in_cksum_hdr(const struct ip *ip) 168 { 169 register u_int sum = 0; 170 register u_int tmp_o2; 171 register u_int tmp_o3; 172 173 __asm__ volatile (" 174 ld [%0], %1 ; \ 175 ld [%0+4], %2 ; \ 176 addcc %1, %2, %1 ; \ 177 ld [%0+8], %2 ; \ 178 addxcc %1, %2, %1 ; \ 179 ld [%0+12], %2 ; \ 180 addxcc %1, %2, %1 ; \ 181 ld [%0+16], %2 ; \ 182 addxcc %1, %2, %1 ; \ 183 set 0x0ffff, %3 ; \ 184 srl %1, 16, %2 ; \ 185 and %1, %3, %1 ; \ 186 addx %1, %2, %1 ; \ 187 srl %1, 16, %1 ; \ 188 add %1, %%g0, %1 ; \ 189 neg %1 ; \ 190 and %1, %3, %1 ; \ 191 " : "=r" (ip), "=r" (sum), "=r" (tmp_o2), "=r" (tmp_o3) 192 : "0" (ip), "1" (sum) 193 ); 194 return sum; 195 } 196 197 #define in_cksum_update(ip) \ 198 do { \ 199 int __tmpsum; \ 200 __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ 201 ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ 202 } while(0) 203 /* 161 204 * Here is the generic, portable, inefficient algorithm. 162 205 */ -
cpukit/libnetworking/rtems/rtems_glue.c
r5eb7da97 r517660f1 699 699 */ 700 700 701 #if (defined(__GNUC__) && defined(sparc))702 703 asm("704 .text705 .global _in_cksum_hdr706 _in_cksum_hdr:707 708 ld [%o0], %o1709 ld [%o0+4], %o2710 addcc %o1, %o2, %o1711 ld [%o0+8], %o2712 addxcc %o1, %o2, %o1713 ld [%o0+12], %o2714 addxcc %o1, %o2, %o1715 ld [%o0+16], %o2716 addxcc %o1, %o2, %o1717 set 0x0ffff, %o3718 srl %o1, 16, %o2719 and %o1, %o3, %o1720 addx %o1, %o2, %o1721 srl %o1, 16, %o1722 add %o1, %g0, %o1723 neg %o1724 retl725 and %o1, %o3, %o0726 727 ");728 #else729 730 701 u_int 731 702 in_cksum_hdr (const void *ip) … … 743 714 return ~sum & 0xFFFF; 744 715 } 745 746 #endif747 716 748 717 /*
Note: See TracChangeset
for help on using the changeset viewer.