COMPARE_AND_EXCHANGE for linux-powerpc

Carlos Valiente carlos at difernet.com
Sun Feb 25 11:17:19 PST 2001


On Friday 23 February 2001 23:19, you wrote:
> Carlos Valiente wrote:
> /*
>  * Do an atomic compare and exchange.  The address 'A' is checked against
>  * value 'O' and if they match it's exchanged with value 'N'.
>  * We return '1' if the exchange is sucessful, otherwise 0.
>  */
> #define COMPARE_AND_EXCHANGE(A,O,N)            \
> ({                                             \
>        int tmp, ret = 0;                       \
>                                                \
>        asm volatile(                           \
>        "1:     lwarx   %0,0,%3\n"              \
>        "       cmpw    0,%0,%4\n"              \
>        "       bne     2f\n"                   \
>        "       stwcx   %5,0,%3\n"              \
> [...]


The assembler included in my linuxppc distro doesn like the opcode 'stwcx` 
(Store Word Conditional Exchange). The error message is "Error: Unrecognized 
opcode: `stwcx'". I have tried with the latest binutils (2.10.1) but it 
doesn't help either.  I will keep investigating, though


More information about the kaffe mailing list