summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2015-12-08 13:37:19 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-12-15 12:51:42 +0100
commit34bfbae33ae84107d0c257edd6c6a8689a09be26 (patch)
tree5d8fbefb9caa76e73a8077217242883dd74a6945 /arch
parentARM: 8471/1: need to save/restore arm register(r11) when it is corrupted (diff)
downloadlinux-34bfbae33ae84107d0c257edd6c6a8689a09be26.tar.xz
linux-34bfbae33ae84107d0c257edd6c6a8689a09be26.zip
ARM: 8475/1: SWP emulation: Restore original *data when failed
__user_swpX_asm maybe failed in first STREX operation, emulate_swpX will try again, but the *data has been changed in first time. which causes the result is wrong. This patch is to fix this issue. When STREX succeed, change the *data. if it fail, *data is not changed. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/swp_emulate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c
index 5b26e7efa9ea..c3fe769d7558 100644
--- a/arch/arm/kernel/swp_emulate.c
+++ b/arch/arm/kernel/swp_emulate.c
@@ -36,10 +36,10 @@
*/
#define __user_swpX_asm(data, addr, res, temp, B) \
__asm__ __volatile__( \
- " mov %2, %1\n" \
- "0: ldrex"B" %1, [%3]\n" \
- "1: strex"B" %0, %2, [%3]\n" \
+ "0: ldrex"B" %2, [%3]\n" \
+ "1: strex"B" %0, %1, [%3]\n" \
" cmp %0, #0\n" \
+ " moveq %1, %2\n" \
" movne %0, %4\n" \
"2:\n" \
" .section .text.fixup,\"ax\"\n" \