arch: arm: userspace: z_arm_userspace_enter: reduce push/pop overhead

ARM user space requires ARM_MPU. We can, therefore,
remove the unnecessary #ifdef CONFIG_ARM_MPU blocks
in userspace.S. In addition, we do minor refactoring
in z_arm_userspace_enter(), and z_arm_pendsv(), and
z_arm_svc(), aiming at reducing the push/pop overhead
as much as possible.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2019-10-11 08:40:39 +02:00 committed by Andrew Boie
commit 237033c61b
2 changed files with 11 additions and 14 deletions

View file

@ -249,8 +249,7 @@ in_fp_endif:
#if defined (CONFIG_ARM_MPU)
/* Re-program dynamic memory map */
push {r2,lr}
ldr r0, =_kernel
ldr r0, [r0, #_kernel_offset_to_current]
mov r0, r2 /* _current thread */
bl z_arm_configure_dynamic_mpu_regions
pop {r2,lr}
#endif
@ -501,7 +500,6 @@ _do_syscall:
/* Bad syscalls treated as valid syscalls with ID K_SYSCALL_BAD. */
valid_syscall_id:
push {r0, r1}
ldr r0, =_kernel
ldr r0, [r0, #_kernel_offset_to_current]
ldr r1, [r0, #_thread_offset_to_mode]
@ -518,7 +516,6 @@ valid_syscall_id:
* instructions with the previous privilege.
*/
isb
pop {r0, r1}
/* return from SVC to the modified LR - z_arm_do_syscall */
bx lr