arch/arm/src/lc823450: Add SP_DMB() into lc823450_testset.c

In lc823450, ldrex and strex are not supported. So we implemented
up_testset() with H/W Mutex. However, there was a bug in memory
access order. This change ensures correct memory access order in
up_testset() for lc823450.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
Masatoshi.Tateishi 2017-12-21 13:26:22 +09:00 committed by Masayuki Ishikawa
parent eef12f1f91
commit 5414d68161

View File

@ -95,12 +95,15 @@ spinlock_t up_testset(volatile FAR spinlock_t *lock)
}
while (getreg32(MUTEX_REG_MUTEX0) != val);
SP_DMB();
ret = *lock;
if (ret == SP_UNLOCKED)
{
*lock = SP_LOCKED;
}
SP_DMB();
val = (up_cpu_index() << 16) | 0x0;
putreg32(val, MUTEX_REG_MUTEX0);