diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2017-03-24 12:15:45 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-08-02 09:15:04 -0400 |
commit | 309ee04257d473ce87f2c7e99f6d69e933d307e3 (patch) | |
tree | d3dacd0ed5bd0e8a420750028990edc723c5ea27 | |
parent | fed3c15531a225d95ec9b0aba4ff01c38de7a1b9 (diff) |
ARM: use aliases for registers in entry-common
Use aliases for the saved (and preserved) PSR and PC values so that we
can control which registers are used.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/kernel/entry-common.S | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index eb5cd77bf1d8..9abe47a206d9 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | #include "entry-header.S" | 28 | #include "entry-header.S" |
29 | 29 | ||
30 | saved_psr .req r8 | ||
31 | saved_pc .req lr | ||
30 | 32 | ||
31 | .align 5 | 33 | .align 5 |
32 | #if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING)) | 34 | #if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING)) |
@@ -141,9 +143,9 @@ ENTRY(vector_swi) | |||
141 | ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr | 143 | ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr |
142 | THUMB( mov r8, sp ) | 144 | THUMB( mov r8, sp ) |
143 | THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr | 145 | THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr |
144 | mrs r8, spsr @ called from non-FIQ mode, so ok. | 146 | mrs saved_psr, spsr @ called from non-FIQ mode, so ok. |
145 | str lr, [sp, #S_PC] @ Save calling PC | 147 | str saved_pc, [sp, #S_PC] @ Save calling PC |
146 | str r8, [sp, #S_PSR] @ Save CPSR | 148 | str saved_psr, [sp, #S_PSR] @ Save CPSR |
147 | str r0, [sp, #S_OLD_R0] @ Save OLD_R0 | 149 | str r0, [sp, #S_OLD_R0] @ Save OLD_R0 |
148 | #endif | 150 | #endif |
149 | zero_fp | 151 | zero_fp |
@@ -163,11 +165,11 @@ ENTRY(vector_swi) | |||
163 | * value to determine if it is an EABI or an old ABI call. | 165 | * value to determine if it is an EABI or an old ABI call. |
164 | */ | 166 | */ |
165 | #ifdef CONFIG_ARM_THUMB | 167 | #ifdef CONFIG_ARM_THUMB |
166 | tst r8, #PSR_T_BIT | 168 | tst saved_psr, #PSR_T_BIT |
167 | movne r10, #0 @ no thumb OABI emulation | 169 | movne r10, #0 @ no thumb OABI emulation |
168 | USER( ldreq r10, [lr, #-4] ) @ get SWI instruction | 170 | USER( ldreq r10, [saved_pc, #-4] ) @ get SWI instruction |
169 | #else | 171 | #else |
170 | USER( ldr r10, [lr, #-4] ) @ get SWI instruction | 172 | USER( ldr r10, [saved_pc, #-4] ) @ get SWI instruction |
171 | #endif | 173 | #endif |
172 | ARM_BE8(rev r10, r10) @ little endian instruction | 174 | ARM_BE8(rev r10, r10) @ little endian instruction |
173 | 175 | ||
@@ -178,15 +180,17 @@ ENTRY(vector_swi) | |||
178 | */ | 180 | */ |
179 | #elif defined(CONFIG_ARM_THUMB) | 181 | #elif defined(CONFIG_ARM_THUMB) |
180 | /* Legacy ABI only, possibly thumb mode. */ | 182 | /* Legacy ABI only, possibly thumb mode. */ |
181 | tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs | 183 | tst saved_psr, #PSR_T_BIT @ this is SPSR from save_user_regs |
182 | addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in | 184 | addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in |
183 | USER( ldreq scno, [lr, #-4] ) | 185 | USER( ldreq scno, [saved_pc, #-4] ) |
184 | 186 | ||
185 | #else | 187 | #else |
186 | /* Legacy ABI only. */ | 188 | /* Legacy ABI only. */ |
187 | USER( ldr scno, [lr, #-4] ) @ get SWI instruction | 189 | USER( ldr scno, [saved_pc, #-4] ) @ get SWI instruction |
188 | #endif | 190 | #endif |
189 | 191 | ||
192 | /* saved_psr and saved_pc are now dead */ | ||
193 | |||
190 | uaccess_disable tbl | 194 | uaccess_disable tbl |
191 | 195 | ||
192 | adr tbl, sys_call_table @ load syscall table pointer | 196 | adr tbl, sys_call_table @ load syscall table pointer |
@@ -234,7 +238,7 @@ local_restart: | |||
234 | * current task. | 238 | * current task. |
235 | */ | 239 | */ |
236 | 9001: | 240 | 9001: |
237 | sub lr, lr, #4 | 241 | sub lr, saved_pc, #4 |
238 | str lr, [sp, #S_PC] | 242 | str lr, [sp, #S_PC] |
239 | b ret_fast_syscall | 243 | b ret_fast_syscall |
240 | #endif | 244 | #endif |