Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: simplify coprocessor.S

Use addresses instead of offsets and drop unneeded offset -> address
calculations. Don't generate any code for undefined coprocessors.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+18 -18
+18 -18
arch/xtensa/kernel/coprocessor.S
··· 33 33 */ 34 34 35 35 #define SAVE_CP_REGS(x) \ 36 - .align 4; \ 37 - .Lsave_cp_regs_cp##x: \ 38 36 .if XTENSA_HAVE_COPROCESSOR(x); \ 37 + .align 4; \ 38 + .Lsave_cp_regs_cp##x: \ 39 39 xchal_cp##x##_store a2 a4 a5 a6 a7; \ 40 - .endif; \ 41 - jx a0 40 + jx a0; \ 41 + .endif 42 42 43 43 #define SAVE_CP_REGS_TAB(x) \ 44 44 .if XTENSA_HAVE_COPROCESSOR(x); \ 45 - .long .Lsave_cp_regs_cp##x - .Lsave_cp_regs_jump_table; \ 45 + .long .Lsave_cp_regs_cp##x; \ 46 46 .else; \ 47 47 .long 0; \ 48 48 .endif; \ ··· 50 50 51 51 52 52 #define LOAD_CP_REGS(x) \ 53 - .align 4; \ 54 - .Lload_cp_regs_cp##x: \ 55 53 .if XTENSA_HAVE_COPROCESSOR(x); \ 54 + .align 4; \ 55 + .Lload_cp_regs_cp##x: \ 56 56 xchal_cp##x##_load a2 a4 a5 a6 a7; \ 57 - .endif; \ 58 - jx a0 57 + jx a0; \ 58 + .endif 59 59 60 60 #define LOAD_CP_REGS_TAB(x) \ 61 61 .if XTENSA_HAVE_COPROCESSOR(x); \ 62 - .long .Lload_cp_regs_cp##x - .Lload_cp_regs_jump_table; \ 62 + .long .Lload_cp_regs_cp##x; \ 63 63 .else; \ 64 64 .long 0; \ 65 65 .endif; \ ··· 83 83 LOAD_CP_REGS(6) 84 84 LOAD_CP_REGS(7) 85 85 86 + .section ".rodata", "a" 86 87 .align 4 87 88 .Lsave_cp_regs_jump_table: 88 89 SAVE_CP_REGS_TAB(0) ··· 104 103 LOAD_CP_REGS_TAB(5) 105 104 LOAD_CP_REGS_TAB(6) 106 105 LOAD_CP_REGS_TAB(7) 106 + 107 + .previous 107 108 108 109 /* 109 110 * coprocessor_flush(struct thread_info*, index) ··· 129 126 l32i a3, a3, 0 130 127 add a2, a2, a4 131 128 beqz a3, 1f 132 - add a0, a0, a3 133 - callx0 a0 129 + callx0 a3 134 130 1: l32i a0, a1, 0 135 131 retw 136 132 ··· 214 212 movi a0, 2f # a0: 'return' address 215 213 addx8 a3, a3, a5 # a3: coprocessor number 216 214 l32i a2, a3, 4 # a2: xtregs offset 217 - l32i a3, a3, 0 # a3: jump offset 215 + l32i a3, a3, 0 # a3: jump address 218 216 add a2, a2, a4 219 - add a4, a3, a5 # a4: address of save routine 220 - jx a4 217 + jx a3 221 218 222 219 /* Note that only a0 and a1 were preserved. */ 223 220 ··· 236 235 movi a0, 1f 237 236 addx8 a3, a3, a5 238 237 l32i a2, a3, 4 # a2: xtregs offset 239 - l32i a3, a3, 0 # a3: jump offset 238 + l32i a3, a3, 0 # a3: jump address 240 239 add a2, a2, a4 241 - add a4, a3, a5 242 - jx a4 240 + jx a3 243 241 244 242 /* Restore all registers and return from exception handler. */ 245 243