diff options
| author | Grissiom <[email protected]> | 2013-05-26 22:37:49 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-05-26 22:37:49 +0800 |
| commit | 19fe6251e7085c39c69945aedde4c00b6167043b (patch) | |
| tree | 4a53382e79408eb20abb5bcca57c48fb7373a735 /libcpu | |
| parent | 435f305fa2d7e189c5251ae050f811eda562be14 (diff) | |
rm48x50: optimize context_switch_interrupt_to by reuse registers
When saving thread registers in context_switch_interrupt_to, we don't
change them, just move them. So there is no need to always r0-r3 from
stack to the real r0-r3. So just use the intermediate registers and
eliminate 2 MOV.
Diffstat (limited to 'libcpu')
| -rw-r--r-- | libcpu/arm/rm48x50/context_ccs.asm | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libcpu/arm/rm48x50/context_ccs.asm b/libcpu/arm/rm48x50/context_ccs.asm index e72f9f0f68..b57674313b 100644 --- a/libcpu/arm/rm48x50/context_ccs.asm +++ b/libcpu/arm/rm48x50/context_ccs.asm @@ -139,12 +139,11 @@ rt_hw_context_switch_interrupt_do STMFD sp!, {r2} ; push old task's pc STMFD sp!, {r4-r12,lr} ; push old task's lr,r12-r4 - MOV r4, r1 ; move original irq sp to r4 - MOV r5, r3 ; move spsr to r5 FIXME: use `MRS r5 spsr` here? - LDMFD r4!, {r0-r3} ; restore r0-r3 of the interrupted thread - STMFD sp!, {r0-r3} ; push old task's r3-r0 - ; FIXME: or move the `MRS r5 spsr` here - STMFD sp!, {r5} ; push old task's cpsr + LDMFD r1!, {r4-r7} ; restore r0-r3 of the interrupted thread + STMFD sp!, {r4-r7} ; push old task's r3-r0. We don't need to push/pop them to + ; r0-r3 because we just want to transfer the data and don't + ; use them here. + STMFD sp!, {r3} ; push old task's cpsr LDR r4, pfromthread LDR r5, [r4] |
