arch/arm: Fix locking in __pendsv
The PendSV handler sits below the priority of other OS interrupts, but it was inspecting kernel state before masking those interrupts out! Move the locking to the top. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
61439b01c2
commit
41070c3b35
1 changed files with 10 additions and 10 deletions
|
@ -54,6 +54,16 @@ SECTION_FUNC(TEXT, __pendsv)
|
||||||
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
||||||
#endif /* CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH */
|
#endif /* CONFIG_KERNEL_EVENT_LOGGER_CONTEXT_SWITCH */
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
#else
|
||||||
|
#error Unknown ARM architecture
|
||||||
|
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
||||||
|
|
||||||
/* load _kernel into r1 and current k_thread into r2 */
|
/* load _kernel into r1 and current k_thread into r2 */
|
||||||
ldr r1, =_kernel
|
ldr r1, =_kernel
|
||||||
ldr r2, [r1, #_kernel_offset_to_current]
|
ldr r2, [r1, #_kernel_offset_to_current]
|
||||||
|
@ -96,16 +106,6 @@ SECTION_FUNC(TEXT, __pendsv)
|
||||||
ldr v4, =_SCS_ICSR
|
ldr v4, =_SCS_ICSR
|
||||||
ldr v3, =_SCS_ICSR_UNPENDSV
|
ldr v3, =_SCS_ICSR_UNPENDSV
|
||||||
|
|
||||||
/* 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
|
|
||||||
#else
|
|
||||||
#error Unknown ARM architecture
|
|
||||||
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
|
|
||||||
|
|
||||||
/* _kernel is still in r1 */
|
/* _kernel is still in r1 */
|
||||||
|
|
||||||
/* fetch the thread to run from the ready queue cache */
|
/* fetch the thread to run from the ready queue cache */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue