Commit 86ecf00f authored by Russell King's avatar Russell King

[ARM] [3/4] Introduce usr_entry macro to contain common entry code

This is the third of 4 patches which factor out common code in
the ARM exception entry assembly code, aiming towards a reduction
in the size of the changes required here for SMP support.  These
patches are low impact, and will be merged over the coarse of the
next few days.

This patch addresses the code handling exception entry from user
modes.
parent 31ae6999
...@@ -191,15 +191,20 @@ __pabt_svc: ...@@ -191,15 +191,20 @@ __pabt_svc:
/* /*
* User mode handlers * User mode handlers
*/ */
.macro usr_entry, sym
sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
stmia sp, {r0 - r12} @ save r0 - r12
ldr r7, .LC\sym
add r5, sp, #S_PC
ldmia r7, {r2 - r4} @ Get USR pc, cpsr
stmia r5, {r2 - r4} @ Save USR pc, cpsr, old_r0
stmdb r5, {sp, lr}^
.endm
.align 5 .align 5
__dabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go __dabt_usr:
stmia sp, {r0 - r12} @ save r0 - r12 usr_entry abt
ldr r7, .LCabt alignment_trap r7, r0, __temp_abt
add r5, sp, #S_PC
ldmia r7, {r2 - r4} @ Get USR pc, cpsr
stmia r5, {r2 - r4} @ Save USR pc, cpsr, old_r0
stmdb r5, {sp, lr}^
alignment_trap r7, r7, __temp_abt
zero_fp zero_fp
#ifdef MULTI_ABORT #ifdef MULTI_ABORT
ldr r4, .LCprocfns @ pass r2, r3 to ldr r4, .LCprocfns @ pass r2, r3 to
...@@ -214,14 +219,9 @@ __dabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go ...@@ -214,14 +219,9 @@ __dabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go
b do_DataAbort b do_DataAbort
.align 5 .align 5
__irq_usr: sub sp, sp, #S_FRAME_SIZE __irq_usr:
stmia sp, {r0 - r12} @ save r0 - r12 usr_entry irq
ldr r4, .LCirq alignment_trap r7, r0, __temp_irq
add r8, sp, #S_PC
ldmia r4, {r5 - r7} @ get saved PC, SPSR
stmia r8, {r5 - r7} @ save pc, psr, old_r0
stmdb r8, {sp, lr}^
alignment_trap r4, r7, __temp_irq
zero_fp zero_fp
#ifdef CONFIG_PREEMPT #ifdef CONFIG_PREEMPT
get_thread_info r8 get_thread_info r8
...@@ -251,18 +251,13 @@ __irq_usr: sub sp, sp, #S_FRAME_SIZE ...@@ -251,18 +251,13 @@ __irq_usr: sub sp, sp, #S_FRAME_SIZE
.ltorg .ltorg
.align 5 .align 5
__und_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go __und_usr:
stmia sp, {r0 - r12} @ Save r0 - r12 usr_entry und
ldr r4, .LCund alignment_trap r7, r0, __temp_und
add r8, sp, #S_PC
ldmia r4, {r5 - r7}
stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0
stmdb r8, {sp, lr}^ @ Save user sp, lr
alignment_trap r4, r7, __temp_und
zero_fp zero_fp
tst r6, #PSR_T_BIT @ Thumb mode? tst r3, #PSR_T_BIT @ Thumb mode?
bne fpundefinstr @ ignore FP bne fpundefinstr @ ignore FP
sub r4, r5, #4 sub r4, r2, #4
1: ldrt r0, [r4] @ r0 = instruction 1: ldrt r0, [r4] @ r0 = instruction
adrsvc al, r9, ret_from_exception @ r9 = normal FP return adrsvc al, r9, ret_from_exception @ r9 = normal FP return
adrsvc al, lr, fpundefinstr @ lr = undefined instr return adrsvc al, lr, fpundefinstr @ lr = undefined instr return
...@@ -361,14 +356,9 @@ fpundefinstr: mov r0, sp ...@@ -361,14 +356,9 @@ fpundefinstr: mov r0, sp
b do_undefinstr b do_undefinstr
.align 5 .align 5
__pabt_usr: sub sp, sp, #S_FRAME_SIZE @ Allocate frame size in one go __pabt_usr:
stmia sp, {r0 - r12} @ Save r0 - r12 usr_entry abt
ldr r4, .LCabt alignment_trap r7, r0, __temp_abt
add r8, sp, #S_PC
ldmia r4, {r5 - r7} @ Get USR pc, cpsr
stmia r8, {r5 - r7} @ Save USR pc, cpsr, old_r0
stmdb r8, {sp, lr}^ @ Save sp_usr lr_usr
alignment_trap r4, r7, __temp_abt
zero_fp zero_fp
enable_irq r0 @ Enable interrupts enable_irq r0 @ Enable interrupts
mov r0, r5 @ address (pc) mov r0, r5 @ address (pc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment