ChangeSet 1.2222, 2005/03/26 13:44:00-08:00, [EMAIL PROTECTED]

        [PATCH] M68k: IP checksum updates
        
        M68k: IP checksum updates:
          - ip_fast_csum() needs a "memory" constraint with new gcc versions
          - Do not always use d0 in ip_fast_csum(), leave register allocation 
to gcc
          - Fixed constraints of csum_fold()
          - Fixed constraints of csum_tcpudp_nofold()
          - Moved comment for csum_tcpudp_magic() to the right place
        
        Signed-off-by: Kars de Jong <[EMAIL PROTECTED]>
        Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 checksum.h |   41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)


diff -Nru a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
--- a/include/asm-m68k/checksum.h       2005-03-26 17:31:16 -08:00
+++ b/include/asm-m68k/checksum.h       2005-03-26 17:31:16 -08:00
@@ -43,20 +43,21 @@
 ip_fast_csum(unsigned char *iph, unsigned int ihl)
 {
        unsigned int sum = 0;
+       unsigned long tmp;
 
        __asm__ ("subqw #1,%2\n"
                 "1:\t"
-                "movel [EMAIL PROTECTED],%/d0\n\t"
-                "addxl %/d0,%0\n\t"
+                "movel [EMAIL PROTECTED],%3\n\t"
+                "addxl %3,%0\n\t"
                 "dbra  %2,1b\n\t"
-                "movel %0,%/d0\n\t"
-                "swap  %/d0\n\t"
-                "addxw %/d0,%0\n\t"
-                "clrw  %/d0\n\t"
-                "addxw %/d0,%0\n\t"
-                : "=d" (sum), "=a" (iph), "=d" (ihl)
+                "movel %0,%3\n\t"
+                "swap  %3\n\t"
+                "addxw %3,%0\n\t"
+                "clrw  %3\n\t"
+                "addxw %3,%0\n\t"
+                : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp)
                 : "0" (sum), "1" (iph), "2" (ihl)
-                : "d0");
+                : "memory");
        return ~sum;
 }
 
@@ -72,31 +73,31 @@
                "clrw %1\n\t"
                "addxw %1, %0"
                : "=&d" (sum), "=&d" (tmp)
-               : "0" (sum), "1" (sum));
+               : "0" (sum), "1" (tmp));
        return ~sum;
 }
 
 
-/*
- * computes the checksum of the TCP/UDP pseudo-header
- * returns a 16-bit checksum, already complemented
- */
-
 static inline unsigned int
 csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short 
len,
                  unsigned short proto, unsigned int sum)
 {
-       __asm__ ("addl  %1,%0\n\t"
+       __asm__ ("addl  %2,%0\n\t"
+                "addxl %3,%0\n\t"
                 "addxl %4,%0\n\t"
-                "addxl %5,%0\n\t"
                 "clrl %1\n\t"
                 "addxl %1,%0"
-                : "=&d" (sum), "=&d" (saddr)
-                : "0" (daddr), "1" (saddr), "d" (len + proto),
-                  "d"(sum));
+                : "=&d" (sum), "=d" (saddr)
+                : "g" (daddr), "1" (saddr), "d" (len + proto),
+                  "0" (sum));
        return sum;
 }
 
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
 static inline unsigned short int
 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
                  unsigned short proto, unsigned int sum)
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to