m68k problem and libstdc++

Andreas Schwab schwab@suse.de
Sat Jan 12 10:03:00 GMT 2002


Craig Rodrigues <rodrigc@mediaone.net> writes:

|> -static inline _Atomic_word 
|> +static inline _Atomic_word
|>  __attribute__ ((__unused__))
|>  __exchange_and_add (volatile _Atomic_word *__mem, int __val)
|>  {
|>    register _Atomic_word __result = *__mem;
|> +
|> +#if defined(__mcpu32__) || defined(__mcf5400__)
|> +  static char __lock = 0;	// needs to be a byte
|> +
|> +  // tas method
|> +  __asm__ __volatile__ ( "1: tas %1;"
|> +		 	 "   jbne 1b;"
|> +			 "   move%.l %3, %0;"
|> +			 "   add%.l %2, %3;"
|> +			 "   clrb %1;"
|> +			 : "=d" (__result), "=m" (__lock)
|> +			 : "d" (__val), "m" (*__mem), "0" (__result)
|> +			 : "memory");

This does not work.  The spinlock must be part of _Atomic_word.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



More information about the Libstdc++ mailing list