Commit 2ca6012d authored by Max Filippov's avatar Max Filippov Committed by Greg Kroah-Hartman

xtensa: fix access to THREAD_RA/THREAD_SP/THREAD_DS

commit 52247123 upstream.

With SMP and a lot of debug options enabled task_struct::thread gets out
of reach of s32i/l32i instructions with base pointing at task_struct,
breaking build with the following messages:

  arch/xtensa/kernel/entry.S: Assembler messages:
  arch/xtensa/kernel/entry.S:1002: Error: operand 3 of 'l32i.n' has invalid value '1048'
  arch/xtensa/kernel/entry.S:1831: Error: operand 3 of 's32i.n' has invalid value '1040'
  arch/xtensa/kernel/entry.S:1832: Error: operand 3 of 's32i.n' has invalid value '1044'

Change base to point to task_struct::thread in such cases.
Don't use a10 in _switch_to to save/restore prev pointer as a2 is not
clobbered.
Signed-off-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6eb4fdf
...@@ -52,7 +52,12 @@ ...@@ -52,7 +52,12 @@
*/ */
.macro get_fs ad, sp .macro get_fs ad, sp
GET_CURRENT(\ad,\sp) GET_CURRENT(\ad,\sp)
#if THREAD_CURRENT_DS > 1020
addi \ad, \ad, TASK_THREAD
l32i \ad, \ad, THREAD_CURRENT_DS - TASK_THREAD
#else
l32i \ad, \ad, THREAD_CURRENT_DS l32i \ad, \ad, THREAD_CURRENT_DS
#endif
.endm .endm
/* /*
......
...@@ -1820,7 +1820,6 @@ ENTRY(_switch_to) ...@@ -1820,7 +1820,6 @@ ENTRY(_switch_to)
entry a1, 16 entry a1, 16
mov a10, a2 # preserve 'prev' (a2)
mov a11, a3 # and 'next' (a3) mov a11, a3 # and 'next' (a3)
l32i a4, a2, TASK_THREAD_INFO l32i a4, a2, TASK_THREAD_INFO
...@@ -1828,8 +1827,14 @@ ENTRY(_switch_to) ...@@ -1828,8 +1827,14 @@ ENTRY(_switch_to)
save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER save_xtregs_user a4 a6 a8 a9 a12 a13 THREAD_XTREGS_USER
s32i a0, a10, THREAD_RA # save return address #if THREAD_RA > 1020 || THREAD_SP > 1020
s32i a1, a10, THREAD_SP # save stack pointer addi a10, a2, TASK_THREAD
s32i a0, a10, THREAD_RA - TASK_THREAD # save return address
s32i a1, a10, THREAD_SP - TASK_THREAD # save stack pointer
#else
s32i a0, a2, THREAD_RA # save return address
s32i a1, a2, THREAD_SP # save stack pointer
#endif
/* Disable ints while we manipulate the stack pointer. */ /* Disable ints while we manipulate the stack pointer. */
...@@ -1870,7 +1875,6 @@ ENTRY(_switch_to) ...@@ -1870,7 +1875,6 @@ ENTRY(_switch_to)
load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER load_xtregs_user a5 a6 a8 a9 a12 a13 THREAD_XTREGS_USER
wsr a14, ps wsr a14, ps
mov a2, a10 # return 'prev'
rsync rsync
retw retw
......
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