diff options
Diffstat (limited to 'cpukit/score/cpu/sparc/sparcv8-atomic.c')
-rw-r--r-- | cpukit/score/cpu/sparc/sparcv8-atomic.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cpukit/score/cpu/sparc/sparcv8-atomic.c b/cpukit/score/cpu/sparc/sparcv8-atomic.c index b1c4f23c88..2b3bdbc451 100644 --- a/cpukit/score/cpu/sparc/sparcv8-atomic.c +++ b/cpukit/score/cpu/sparc/sparcv8-atomic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. + * Copyright (c) 2014-2015 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -118,12 +118,16 @@ bool __atomic_compare_exchange_4( { bool equal; ISR_Level level; + uint32_t actual; level = _SPARCV8_Acquire_the_one_lock(); - equal = *mem == *expected; + actual = *mem; + equal = ( actual == *expected ); if ( equal ) { *mem = desired; + } else { + *expected = actual; } _SPARCV8_Release_the_one_lock( level ); |