Skip to content

Commit 309ee04

Browse files
author
Russell King
committed
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>
1 parent fed3c15 commit 309ee04

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

‎arch/arm/kernel/entry-common.S‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
#include "entry-header.S"
2929

30+
saved_psr .req r8
31+
saved_pc .req lr
3032

3133
.align 5
3234
#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING))
@@ -141,9 +143,9 @@ ENTRY(vector_swi)
141143
ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr
142144
THUMB( mov r8, sp )
143145
THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr
144-
mrs r8, spsr @ called from non-FIQ mode, so ok.
145-
str lr, [sp, #S_PC] @ Save calling PC
146-
str r8, [sp, #S_PSR] @ Save CPSR
146+
mrs saved_psr, spsr @ called from non-FIQ mode, so ok.
147+
str saved_pc, [sp, #S_PC] @ Save calling PC
148+
str saved_psr, [sp, #S_PSR] @ Save CPSR
147149
str r0, [sp, #S_OLD_R0] @ Save OLD_R0
148150
#endif
149151
zero_fp
@@ -163,11 +165,11 @@ ENTRY(vector_swi)
163165
* value to determine if it is an EABI or an old ABI call.
164166
*/
165167
#ifdef CONFIG_ARM_THUMB
166-
tst r8, #PSR_T_BIT
168+
tst saved_psr, #PSR_T_BIT
167169
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
169171
#else
170-
USER( ldr r10, [lr, #-4] ) @ get SWI instruction
172+
USER( ldr r10, [saved_pc, #-4] ) @ get SWI instruction
171173
#endif
172174
ARM_BE8(rev r10, r10) @ little endian instruction
173175

@@ -178,15 +180,17 @@ ENTRY(vector_swi)
178180
*/
179181
#elif defined(CONFIG_ARM_THUMB)
180182
/* 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
182184
addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
183-
USER( ldreq scno, [lr, #-4] )
185+
USER( ldreq scno, [saved_pc, #-4] )
184186

185187
#else
186188
/* Legacy ABI only. */
187-
USER( ldr scno, [lr, #-4] ) @ get SWI instruction
189+
USER( ldr scno, [saved_pc, #-4] ) @ get SWI instruction
188190
#endif
189191

192+
/* saved_psr and saved_pc are now dead */
193+
190194
uaccess_disable tbl
191195

192196
adr tbl, sys_call_table @ load syscall table pointer
@@ -234,7 +238,7 @@ local_restart:
234238
* current task.
235239
*/
236240
9001:
237-
sub lr, lr, #4
241+
sub lr, saved_pc, #4
238242
str lr, [sp, #S_PC]
239243
b ret_fast_syscall
240244
#endif

0 commit comments

Comments
 (0)