arch: arm: Remove unnecessary register preservation in Cortex-R port.

The interrupt exit and swap service routines for Cortex-R
unnecessarily preserve r0 and lr registers when making function calls
using bl instruction.

In case of _IntExit in exc_exit.S, the r0 register containing the
caller mode is preserved at the top, and the lr register can safely be
assumed to have been saved into the system mode stack by the interrupt
service routine.

In case of __svc in swap_helper.S, since the function saves lr to the
system mode stack at the top and exits through _IntExit, it is not
necessary to preserve lr register when executing bl instructions.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2019-09-26 15:03:34 +09:00 committed by Maureen Helm
commit 8c4de7e4b0
2 changed files with 4 additions and 6 deletions

View file

@ -560,9 +560,7 @@ demux:
beq _oops
#if CONFIG_IRQ_OFFLOAD
push {r0, lr}
blx z_irq_do_offload /* call C routine which executes the offload */
pop {r0, lr}
/* exception return is done in z_arm_int_exit() */
mov r0, #RET_FROM_SVC
@ -571,9 +569,7 @@ demux:
_context_switch:
/* handler mode exit, to PendSV */
push {r0, lr}
bl z_arm_pendsv
pop {r0, lr}
mov r0, #RET_FROM_SVC
b z_arm_int_exit