]> git.hungrycats.org Git - linux/commitdiff
[ARM PATCH] 1881/1: Illegal strex instruction generated by gcc
authorCatalin Marinas <catalin.marinas@com.rmk.(none)>
Sat, 15 May 2004 16:13:48 +0000 (17:13 +0100)
committerRussell King <rmk@flint.arm.linux.org.uk>
Sat, 15 May 2004 16:13:48 +0000 (17:13 +0100)
Patch from Catalin Marinas

The _raw_write_(try)lock functions in include/asm-arm/spinlock.h

should use the early clobber modifier (&) for the "tmp" register.

A newer compiler (gcc-3.4.0) generates an "strexeq %0, %1, [%2]"

instruction where %0 is the same as %2, which is illegal.

include/asm-arm/spinlock.h

index eed3f6594118ac5532f5ad758990507ffa71b1f3..1c22e7feabf508af0aeec20eea670e1bfda2f018 100644 (file)
@@ -89,7 +89,7 @@ static inline void _raw_write_lock(rwlock_t *rw)
 "      strexeq %0, %2, [%1]\n"
 "      teq     %0, #0\n"
 "      bne     1b"
-       : "=r" (tmp)
+       : "=&r" (tmp)
        : "r" (&rw->lock), "r" (0x80000000)
        : "cc", "memory");
 }
@@ -151,7 +151,7 @@ static inline int _raw_write_trylock(rwlock_t *rw)
 "1:    ldrex   %0, [%1]\n"
 "      teq     %0, #0\n"
 "      strexeq %0, %2, [%1]"
-       : "=r" (tmp)
+       : "=&r" (tmp)
        : "r" (&rw->lock), "r" (0x80000000)
        : "cc", "memory");