From 102016ca2e7a5ecb1d741bc99123e3f64dba291b Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 3 Oct 2021 10:39:22 +0000 Subject: [PATCH] Small optimization. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14864 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- .../ports/ARMv7-M-ALT/compilers/GCC/chcoreasm.S | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/os/common/ports/ARMv7-M-ALT/compilers/GCC/chcoreasm.S b/os/common/ports/ARMv7-M-ALT/compilers/GCC/chcoreasm.S index 9dd3eb3ed..bea500cfc 100644 --- a/os/common/ports/ARMv7-M-ALT/compilers/GCC/chcoreasm.S +++ b/os/common/ports/ARMv7-M-ALT/compilers/GCC/chcoreasm.S @@ -210,12 +210,12 @@ SVC_Handler: /* Context load for new thread.*/ adds r0, #CONTEXT_OFFSET - PORT_LOAD_INTEGER_CONTEXT #if CH_DBG_SYSTEM_STATE_CHECK || CH_DBG_STATISTICS + ldr r3, [r0, #4] /* BASEPRI offset */ cmp r3, #CORTEX_BASEPRI_DISABLED bne 1f - push {r0, lr} + mov r4, r0 /* Returning to a preempted thread, performing a logical "unlock" and handling statistics.*/ #if CH_DBG_SYSTEM_STATE_CHECK @@ -224,10 +224,11 @@ SVC_Handler: #if CH_DBG_STATISTICS bl __stats_stop_measure_crit_thd #endif - pop {r0, lr} + mov r0, r4 1: #endif /* CH_DBG_SYSTEM_STATE_CHECK || CH_DBG_STATISTICS */ + PORT_LOAD_INTEGER_CONTEXT PORT_LOAD_FLOAT_CONTEXT PORT_LOAD_MPU_CONTEXT @@ -257,12 +258,12 @@ PendSV_Handler: /* Context load for new thread.*/ adds r0, #CONTEXT_OFFSET - PORT_LOAD_INTEGER_CONTEXT #if CH_DBG_SYSTEM_STATE_CHECK || CH_DBG_STATISTICS + ldr r3, [r0, #4] /* BASEPRI offset */ cmp r3, #CORTEX_BASEPRI_DISABLED bne 1f - push {r0, lr} + mov r4, r0 /* Returning to a preempted thread, performing a logical "unlock" and handling statistics.*/ #if CH_DBG_SYSTEM_STATE_CHECK @@ -271,10 +272,11 @@ PendSV_Handler: #if CH_DBG_STATISTICS bl __stats_stop_measure_crit_thd #endif - pop {r0, lr} + mov r0, r4 1: #endif /* CH_DBG_SYSTEM_STATE_CHECK || CH_DBG_STATISTICS */ + PORT_LOAD_INTEGER_CONTEXT PORT_LOAD_FLOAT_CONTEXT PORT_LOAD_MPU_CONTEXT