/[hurd]/hurd/pfinet/linux-src/include/asm-i386/checksum.h
ViewVC logotype

Diff of /hurd/pfinet/linux-src/include/asm-i386/checksum.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by roland, Fri Feb 4 03:21:18 2000 UTC revision 1.2 by marcus, Wed May 7 13:41:44 2003 UTC
# Line 87  static inline unsigned short ip_fast_csu Line 87  static inline unsigned short ip_fast_csu
87                                            unsigned int ihl) {                                            unsigned int ihl) {
88          unsigned int sum;          unsigned int sum;
89    
90          __asm__ __volatile__("          __asm__ __volatile__(
91              movl (%1), %0  "           movl (%1), %0\n"
92              subl $4, %2  "           subl $4, %2\n"
93              jbe 2f  "           jbe 2f\n"
94              addl 4(%1), %0  "           addl 4(%1), %0\n"
95              adcl 8(%1), %0  "           adcl 8(%1), %0\n"
96              adcl 12(%1), %0  "           adcl 12(%1), %0\n"
97  1:          adcl 16(%1), %0  "1:         adcl 16(%1), %0\n"
98              lea 4(%1), %1  "           lea 4(%1), %1\n"
99              decl %2  "           decl %2\n"
100              jne 1b  "           jne 1b\n"
101              adcl $0, %0  "           adcl $0, %0\n"
102              movl %0, %2  "           movl %0, %2\n"
103              shrl $16, %0  "           shrl $16, %0\n"
104              addw %w2, %w0  "           addw %w2, %w0\n"
105              adcl $0, %0  "           adcl $0, %0\n"
106              notl %0  "           notl %0\n"
107  2:  "2:"
             "  
108          /* Since the input registers which are loaded with iph and ipl          /* Since the input registers which are loaded with iph and ipl
109             are modified, we must also specify them as outputs, or gcc             are modified, we must also specify them as outputs, or gcc
110             will assume they contain their original values. */             will assume they contain their original values. */
# Line 120  static inline unsigned short ip_fast_csu Line 119  static inline unsigned short ip_fast_csu
119    
120  static inline unsigned int csum_fold(unsigned int sum)  static inline unsigned int csum_fold(unsigned int sum)
121  {  {
122          __asm__("          __asm__("addl %1, %0\n"
123                  addl %1, %0                  "adcl $0xffff, %0\n"
                 adcl $0xffff, %0  
                 "  
124                  : "=r" (sum)                  : "=r" (sum)
125                  : "r" (sum << 16), "0" (sum & 0xffff0000)                  : "r" (sum << 16), "0" (sum & 0xffff0000)
126          );          );
# Line 136  static inline unsigned long csum_tcpudp_ Line 133  static inline unsigned long csum_tcpudp_
133                                                     unsigned short proto,                                                     unsigned short proto,
134                                                     unsigned int sum)                                                     unsigned int sum)
135  {  {
136      __asm__("      __asm__(
137          addl %1, %0          "addl %1, %0\n"
138          adcl %2, %0          "adcl %2, %0\n"
139          adcl %3, %0          "adcl %3, %0\n"
140          adcl $0, %0          "adcl $0, %0\n"
         "  
141          : "=r" (sum)          : "=r" (sum)
142          : "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256), "0"(sum));          : "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256), "0"(sum));
143      return sum;      return sum;
# Line 176  static __inline__ unsigned short int csu Line 172  static __inline__ unsigned short int csu
172                                                       unsigned short proto,                                                       unsigned short proto,
173                                                       unsigned int sum)                                                       unsigned int sum)
174  {  {
175          __asm__("          __asm__("addl 0(%1), %0\n"
176                  addl 0(%1), %0                  "adcl 4(%1), %0\n"
177                  adcl 4(%1), %0                  "adcl 8(%1), %0\n"
178                  adcl 8(%1), %0                  "adcl 12(%1), %0\n"
179                  adcl 12(%1), %0                  "adcl 0(%2), %0\n"
180                  adcl 0(%2), %0                  "adcl 4(%2), %0\n"
181                  adcl 4(%2), %0                  "adcl 8(%2), %0\n"
182                  adcl 8(%2), %0                  "adcl 12(%2), %0\n"
183                  adcl 12(%2), %0                  "adcl %3, %0\n"
184                  adcl %3, %0                  "adcl %4, %0\n"
185                  adcl %4, %0                  "adcl $0, %0\n"
                 adcl $0, %0  
                 "  
186                  : "=&r" (sum)                  : "=&r" (sum)
187                  : "r" (saddr), "r" (daddr),                  : "r" (saddr), "r" (daddr),
188                    "r"(htonl((__u32) (len))), "r"(htonl(proto)), "0"(sum));                    "r"(htonl((__u32) (len))), "r"(htonl(proto)), "0"(sum));

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26