diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-07-24 07:32:54 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-07-24 07:32:54 -0400 |
commit | b86040a59feb255a8193173caa4d5199464433d5 (patch) | |
tree | 89c07450eabc2abb88bb4d6e32d61fd3855f000e /arch/arm/kernel/entry-common.S | |
parent | 0becb088501886f37ade38762c8eaaf4263572cc (diff) |
Thumb-2: Implementation of the unified start-up and exceptions code
This patch implements the ARM/Thumb-2 unified kernel start-up and
exception handling code.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm/kernel/entry-common.S')
-rw-r--r-- | arch/arm/kernel/entry-common.S | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 366e5097a41a..a0540c9f1f0c 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -33,14 +33,7 @@ ret_fast_syscall: | |||
33 | /* perform architecture specific actions before user return */ | 33 | /* perform architecture specific actions before user return */ |
34 | arch_ret_to_user r1, lr | 34 | arch_ret_to_user r1, lr |
35 | 35 | ||
36 | @ fast_restore_user_regs | 36 | restore_user_regs fast = 1, offset = S_OFF |
37 | ldr r1, [sp, #S_OFF + S_PSR] @ get calling cpsr | ||
38 | ldr lr, [sp, #S_OFF + S_PC]! @ get pc | ||
39 | msr spsr_cxsf, r1 @ save in spsr_svc | ||
40 | ldmdb sp, {r1 - lr}^ @ get calling r1 - lr | ||
41 | mov r0, r0 | ||
42 | add sp, sp, #S_FRAME_SIZE - S_PC | ||
43 | movs pc, lr @ return & move spsr_svc into cpsr | ||
44 | UNWIND(.fnend ) | 37 | UNWIND(.fnend ) |
45 | 38 | ||
46 | /* | 39 | /* |
@@ -73,14 +66,7 @@ no_work_pending: | |||
73 | /* perform architecture specific actions before user return */ | 66 | /* perform architecture specific actions before user return */ |
74 | arch_ret_to_user r1, lr | 67 | arch_ret_to_user r1, lr |
75 | 68 | ||
76 | @ slow_restore_user_regs | 69 | restore_user_regs fast = 0, offset = 0 |
77 | ldr r1, [sp, #S_PSR] @ get calling cpsr | ||
78 | ldr lr, [sp, #S_PC]! @ get pc | ||
79 | msr spsr_cxsf, r1 @ save in spsr_svc | ||
80 | ldmdb sp, {r0 - lr}^ @ get calling r0 - lr | ||
81 | mov r0, r0 | ||
82 | add sp, sp, #S_FRAME_SIZE - S_PC | ||
83 | movs pc, lr @ return & move spsr_svc into cpsr | ||
84 | ENDPROC(ret_to_user) | 70 | ENDPROC(ret_to_user) |
85 | 71 | ||
86 | /* | 72 | /* |
@@ -182,8 +168,10 @@ ftrace_stub: | |||
182 | ENTRY(vector_swi) | 168 | ENTRY(vector_swi) |
183 | sub sp, sp, #S_FRAME_SIZE | 169 | sub sp, sp, #S_FRAME_SIZE |
184 | stmia sp, {r0 - r12} @ Calling r0 - r12 | 170 | stmia sp, {r0 - r12} @ Calling r0 - r12 |
185 | add r8, sp, #S_PC | 171 | ARM( add r8, sp, #S_PC ) |
186 | stmdb r8, {sp, lr}^ @ Calling sp, lr | 172 | ARM( stmdb r8, {sp, lr}^ ) @ Calling sp, lr |
173 | THUMB( mov r8, sp ) | ||
174 | THUMB( store_user_sp_lr r8, r10, S_SP ) @ calling sp, lr | ||
187 | mrs r8, spsr @ called from non-FIQ mode, so ok. | 175 | mrs r8, spsr @ called from non-FIQ mode, so ok. |
188 | str lr, [sp, #S_PC] @ Save calling PC | 176 | str lr, [sp, #S_PC] @ Save calling PC |
189 | str r8, [sp, #S_PSR] @ Save CPSR | 177 | str r8, [sp, #S_PSR] @ Save CPSR |
@@ -272,7 +260,7 @@ ENTRY(vector_swi) | |||
272 | bne __sys_trace | 260 | bne __sys_trace |
273 | 261 | ||
274 | cmp scno, #NR_syscalls @ check upper syscall limit | 262 | cmp scno, #NR_syscalls @ check upper syscall limit |
275 | adr lr, ret_fast_syscall @ return address | 263 | adr lr, BSYM(ret_fast_syscall) @ return address |
276 | ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine | 264 | ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine |
277 | 265 | ||
278 | add r1, sp, #S_OFF | 266 | add r1, sp, #S_OFF |
@@ -293,7 +281,7 @@ __sys_trace: | |||
293 | mov r0, #0 @ trace entry [IP = 0] | 281 | mov r0, #0 @ trace entry [IP = 0] |
294 | bl syscall_trace | 282 | bl syscall_trace |
295 | 283 | ||
296 | adr lr, __sys_trace_return @ return address | 284 | adr lr, BSYM(__sys_trace_return) @ return address |
297 | mov scno, r0 @ syscall number (possibly new) | 285 | mov scno, r0 @ syscall number (possibly new) |
298 | add r1, sp, #S_R0 + S_OFF @ pointer to regs | 286 | add r1, sp, #S_R0 + S_OFF @ pointer to regs |
299 | cmp scno, #NR_syscalls @ check upper syscall limit | 287 | cmp scno, #NR_syscalls @ check upper syscall limit |