Skip to content

Commit 6aaa3c2

Browse files
jcmvbkbcgregkh
authored andcommitted
xtensa: move coprocessor_flush to the .text section
commit ab5eb33 upstream. coprocessor_flush is not a part of fast exception handlers, but it uses parts of fast coprocessor handling code that's why it's in the same source file. It uses call0 opcode to invoke those parts so there are no limitations on their relative location, but the rest of the code calls coprocessor_flush with call8 and that doesn't work when vectors are placed in a different gigabyte-aligned area than the rest of the kernel. Move coprocessor_flush from the .exception.text section to the .text so that it's reachable from the rest of the kernel with call8. Cc: stable@vger.kernel.org Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a3be911 commit 6aaa3c2

1 file changed

Lines changed: 33 additions & 31 deletions

File tree

‎arch/xtensa/kernel/coprocessor.S‎

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -99,37 +99,6 @@
9999
LOAD_CP_REGS_TAB(6)
100100
LOAD_CP_REGS_TAB(7)
101101

102-
/*
103-
* coprocessor_flush(struct thread_info*, index)
104-
* a2 a3
105-
*
106-
* Save coprocessor registers for coprocessor 'index'.
107-
* The register values are saved to or loaded from the coprocessor area
108-
* inside the task_info structure.
109-
*
110-
* Note that this function doesn't update the coprocessor_owner information!
111-
*
112-
*/
113-
114-
ENTRY(coprocessor_flush)
115-
116-
/* reserve 4 bytes on stack to save a0 */
117-
abi_entry(4)
118-
119-
s32i a0, a1, 0
120-
movi a0, .Lsave_cp_regs_jump_table
121-
addx8 a3, a3, a0
122-
l32i a4, a3, 4
123-
l32i a3, a3, 0
124-
add a2, a2, a4
125-
beqz a3, 1f
126-
callx0 a3
127-
1: l32i a0, a1, 0
128-
129-
abi_ret(4)
130-
131-
ENDPROC(coprocessor_flush)
132-
133102
/*
134103
* Entry condition:
135104
*
@@ -245,6 +214,39 @@ ENTRY(fast_coprocessor)
245214

246215
ENDPROC(fast_coprocessor)
247216

217+
.text
218+
219+
/*
220+
* coprocessor_flush(struct thread_info*, index)
221+
* a2 a3
222+
*
223+
* Save coprocessor registers for coprocessor 'index'.
224+
* The register values are saved to or loaded from the coprocessor area
225+
* inside the task_info structure.
226+
*
227+
* Note that this function doesn't update the coprocessor_owner information!
228+
*
229+
*/
230+
231+
ENTRY(coprocessor_flush)
232+
233+
/* reserve 4 bytes on stack to save a0 */
234+
abi_entry(4)
235+
236+
s32i a0, a1, 0
237+
movi a0, .Lsave_cp_regs_jump_table
238+
addx8 a3, a3, a0
239+
l32i a4, a3, 4
240+
l32i a3, a3, 0
241+
add a2, a2, a4
242+
beqz a3, 1f
243+
callx0 a3
244+
1: l32i a0, a1, 0
245+
246+
abi_ret(4)
247+
248+
ENDPROC(coprocessor_flush)
249+
248250
.data
249251

250252
ENTRY(coprocessor_owner)

0 commit comments

Comments
 (0)