From 338e0e520e907e37abdec1eb0f927185328ea9e7 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Sat, 27 Apr 2019 05:26:17 +0200 Subject: [PATCH] arch: arm: restrict IRQ lock to minimum during pendSV exception When performing thread context-switch it is not necessary to have IRQs locked while saving the current thread's callee-saved (and possibly floating point) registers. We only need to lock the interrupts when accessing the thread ready queue cache. Signed-off-by: Ioannis Glaropoulos --- arch/arm/core/swap_helper.S | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/core/swap_helper.S b/arch/arm/core/swap_helper.S index 8a8acd702c67..6c5939ea3ebe 100644 --- a/arch/arm/core/swap_helper.S +++ b/arch/arm/core/swap_helper.S @@ -55,17 +55,6 @@ SECTION_FUNC(TEXT, __pendsv) #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ #endif /* CONFIG_TRACING */ - /* protect the kernel state while we play with the thread lists */ -#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) - cpsid i -#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) - movs.n r0, #_EXC_IRQ_DEFAULT_PRIO - msr BASEPRI, r0 - isb /* Make the effect of disabling interrupts be realized immediately */ -#else -#error Unknown ARM architecture -#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ - /* load _kernel into r1 and current k_thread into r2 */ ldr r1, =_kernel ldr r2, [r1, #_kernel_offset_to_current] @@ -96,6 +85,17 @@ SECTION_FUNC(TEXT, __pendsv) #endif /* CONFIG_FP_SHARING */ #else #error Unknown ARM architecture +#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ + + /* Protect the kernel state while we play with the thread lists */ +#if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) + cpsid i +#elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + movs.n r0, #_EXC_IRQ_DEFAULT_PRIO + msr BASEPRI, r0 + isb /* Make the effect of disabling interrupts be realized immediately */ +#else +#error Unknown ARM architecture #endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */ /*