[kaffe] MIPS Port Update

Kevin D. Kissell kevink@mips.com
Wed, 17 Jul 2002 14:48:05 +0200


> 2) The proposed code does not deal with the fact 
>     that the function is specified to return 1 on
>     success, and zero if no exchange occurred.

I should say, it tries to do it with a C epilog: 

     + (*(addr)) == (newVal) ? 1 : 0;})

But there is no guarantee that the compiler will
have tracked and preserved the value written with 
the store conditional (which, being in an asm block,  
might not even be treated as a "store" by the compiler
if we aren't lucky) so as to avoid re-reading *addr.  
If the location is re-loaded, the comparison is not
necessarily going to provide the right response.
The operation may have succeeded, but some other 
thread may have switched in and changed the value 
yet again in the mean time.

One way or another, we have to base the returned 
status on a comparison with the load-locked value.

[rest of my pedantic rant deleted]

            Kevin K.