diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-09-25 21:31:00 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-09-25 21:48:24 +0200 |
commit | 1f7c5c88ca384baa312a0714c6e93174605418a7 (patch) | |
tree | feeef5efadbbc839a35f8f8d0d393c43578d1ad6 /cpukit/score/cpu/sparc | |
parent | ARMv7M: Improve exception handler routine and add comments on SP selection (diff) | |
download | rtems-1f7c5c88ca384baa312a0714c6e93174605418a7.tar.bz2 |
score: Fix atomic compare exchange
Diffstat (limited to 'cpukit/score/cpu/sparc')
-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 ); |