]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
FRV: ip_fast_csum() requires a memory clobber on its inline asm
authorDavid Howells <dhowells@redhat.com>
Thu, 5 Jun 2008 16:07:35 +0000 (17:07 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 5 Jun 2008 17:31:21 +0000 (10:31 -0700)
ip_fast_csum() requires a memory clobber on its inline asm as it accesses
memory in a fashion that gcc can't predict.

The GCC manual says:

 If your assembler instructions access memory in an unpredictable
 fashion, add `memory' to the list of clobbered registers.  This will
 cause GCC to not keep memory values cached in registers across the
 assembler instruction and not optimize stores or loads to that memory.

The bug hasn't been noticed in FRV, but it has been seen in PA-RISC.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/asm-frv/checksum.h

index 9b1689850187c91a51b203a988e81e16bd2ba5f6..269da09ff637f5f1a3bfb6b5ef55e8002bae3f16 100644 (file)
@@ -75,7 +75,7 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
            : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp)
            : "0" (sum), "1" (iph), "2" (ihl), "3" (4),
            "m"(*(volatile struct { int _[100]; } *)iph)
-           : "icc0", "icc1"
+           : "icc0", "icc1", "memory"
            );
 
        return (__force __sum16)~sum;