Commit 2b01a2d3 authored by Catalin Marinas's avatar Catalin Marinas Committed by Russell King

[ARM PATCH] 1881/1: Illegal strex instruction generated by gcc

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.
parent 34dadab4
...@@ -89,7 +89,7 @@ static inline void _raw_write_lock(rwlock_t *rw) ...@@ -89,7 +89,7 @@ static inline void _raw_write_lock(rwlock_t *rw)
" strexeq %0, %2, [%1]\n" " strexeq %0, %2, [%1]\n"
" teq %0, #0\n" " teq %0, #0\n"
" bne 1b" " bne 1b"
: "=r" (tmp) : "=&r" (tmp)
: "r" (&rw->lock), "r" (0x80000000) : "r" (&rw->lock), "r" (0x80000000)
: "cc", "memory"); : "cc", "memory");
} }
...@@ -151,7 +151,7 @@ static inline int _raw_write_trylock(rwlock_t *rw) ...@@ -151,7 +151,7 @@ static inline int _raw_write_trylock(rwlock_t *rw)
"1: ldrex %0, [%1]\n" "1: ldrex %0, [%1]\n"
" teq %0, #0\n" " teq %0, #0\n"
" strexeq %0, %2, [%1]" " strexeq %0, %2, [%1]"
: "=r" (tmp) : "=&r" (tmp)
: "r" (&rw->lock), "r" (0x80000000) : "r" (&rw->lock), "r" (0x80000000)
: "cc", "memory"); : "cc", "memory");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment