Commit 7e5866d8 authored by Max Filippov's avatar Max Filippov Committed by Greg Kroah-Hartman

xtensa: fix a6 and a7 handling in fast_syscall_xtensa

commit d1b6ba82 upstream.

Remove restoring a6 on some return paths and instead modify and restore
it in a single place, using symbolic name.
Correctly restore a7 from PT_AREG7 in case of illegal a6 value.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bbfb4ca
...@@ -1001,9 +1001,8 @@ ENTRY(fast_syscall_xtensa) ...@@ -1001,9 +1001,8 @@ ENTRY(fast_syscall_xtensa)
movi a7, 4 # sizeof(unsigned int) movi a7, 4 # sizeof(unsigned int)
access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp access_ok a3, a7, a0, a2, .Leac # a0: scratch reg, a2: sp
addi a6, a6, -1 # assuming SYS_XTENSA_ATOMIC_SET = 1 _bgeui a6, SYS_XTENSA_COUNT, .Lill
_bgeui a6, SYS_XTENSA_COUNT - 1, .Lill _bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP, .Lnswp
_bnei a6, SYS_XTENSA_ATOMIC_CMP_SWP - 1, .Lnswp
/* Fall through for ATOMIC_CMP_SWP. */ /* Fall through for ATOMIC_CMP_SWP. */
...@@ -1015,27 +1014,26 @@ TRY s32i a5, a3, 0 # different, modify value ...@@ -1015,27 +1014,26 @@ TRY s32i a5, a3, 0 # different, modify value
l32i a7, a2, PT_AREG7 # restore a7 l32i a7, a2, PT_AREG7 # restore a7
l32i a0, a2, PT_AREG0 # restore a0 l32i a0, a2, PT_AREG0 # restore a0
movi a2, 1 # and return 1 movi a2, 1 # and return 1
addi a6, a6, 1 # restore a6 (really necessary?)
rfe rfe
1: l32i a7, a2, PT_AREG7 # restore a7 1: l32i a7, a2, PT_AREG7 # restore a7
l32i a0, a2, PT_AREG0 # restore a0 l32i a0, a2, PT_AREG0 # restore a0
movi a2, 0 # return 0 (note that we cannot set movi a2, 0 # return 0 (note that we cannot set
addi a6, a6, 1 # restore a6 (really necessary?)
rfe rfe
.Lnswp: /* Atomic set, add, and exg_add. */ .Lnswp: /* Atomic set, add, and exg_add. */
TRY l32i a7, a3, 0 # orig TRY l32i a7, a3, 0 # orig
addi a6, a6, -SYS_XTENSA_ATOMIC_SET
add a0, a4, a7 # + arg add a0, a4, a7 # + arg
moveqz a0, a4, a6 # set moveqz a0, a4, a6 # set
addi a6, a6, SYS_XTENSA_ATOMIC_SET
TRY s32i a0, a3, 0 # write new value TRY s32i a0, a3, 0 # write new value
mov a0, a2 mov a0, a2
mov a2, a7 mov a2, a7
l32i a7, a0, PT_AREG7 # restore a7 l32i a7, a0, PT_AREG7 # restore a7
l32i a0, a0, PT_AREG0 # restore a0 l32i a0, a0, PT_AREG0 # restore a0
addi a6, a6, 1 # restore a6 (really necessary?)
rfe rfe
CATCH CATCH
...@@ -1044,7 +1042,7 @@ CATCH ...@@ -1044,7 +1042,7 @@ CATCH
movi a2, -EFAULT movi a2, -EFAULT
rfe rfe
.Lill: l32i a7, a2, PT_AREG0 # restore a7 .Lill: l32i a7, a2, PT_AREG7 # restore a7
l32i a0, a2, PT_AREG0 # restore a0 l32i a0, a2, PT_AREG0 # restore a0
movi a2, -EINVAL movi a2, -EINVAL
rfe rfe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment