arch: arm: Use ldrex & strex to perform swap
For ARMv7 & above the swp instructions are deprecated. Instead use
ldrex and strex to perform swap operations.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dai0425/BABCAIHG.html
Change-Id: Ibd1135d76b1920f48c884f16eaabb0d69a750f78
diff --git a/arch/arm/ops.S b/arch/arm/ops.S
index 6daea96..4cfd180 100644
--- a/arch/arm/ops.S
+++ b/arch/arm/ops.S
@@ -42,7 +42,13 @@
/* int atomic_swap(int *ptr, int val); */
FUNCTION(atomic_swap)
- swp r0, r2, [r1]
+.L_loop_swap:
+ ldrex r12, [r0]
+ strex r2, r1, [r0]
+ cmp r2 , #0
+ bne .L_loop_swap
+
+ mov r0, r12
bx lr
/* int atomic_add(int *ptr, int val); */