017a8eea4f
The atomic_cas function was using incorrect register when determining whether value was swapped. The swapping instruction s32c1i in atomic_cas stores the value at memory location in register a4 regardless of whether swapping is done. In this case, the register a4 should be used to determine whether a swap is done. However, register a3 (containing the oldValue as function argument) is used instead. Since register a5 contains the old value at address loaded before the swapping instruction, a3 and a5 contain the same value. Since a3 == a5 is always true in this case, the function will always return 1 even though values are not swapped. So fix it by using the correct register. Also, in case the value is not swapped, it jumps to where it returns zero instead of loading from memory and comparing again. The function was simply looping until swapping was done, which did not align with the API where it would return 0 when swapping is not done (regardless whether the memory location contains the old value or not). Signed-off-by: Daniel Leung <daniel.leung@intel.com> |
||
---|---|---|
.. | ||
core | ||
include | ||
CMakeLists.txt | ||
Kconfig |