From 1bfa7e3d93866a6e0f3d33fb4b65dbc43e63b334 Mon Sep 17 00:00:00 2001 From: Benjamin Walsh Date: Fri, 4 Nov 2016 12:02:50 -0400 Subject: [PATCH] unified/arm: fix missing setting of default _Swap() return value The unified kernel expect the default return value from a _Swap() call to be set to -EAGAIN by the architecture code. Cortex-M3/M4 does this in the SVC call handler, and it was missing from the Cortex-M0/M0+ before pending PendSV. Change-Id: I3316901186ab409f49043eb4f1972c4b0dd9a4a2 Signed-off-by: Benjamin Walsh --- arch/arm/core/swap.S | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/core/swap.S b/arch/arm/core/swap.S index 28e9e5efa98..be148f9de8c 100644 --- a/arch/arm/core/swap.S +++ b/arch/arm/core/swap.S @@ -352,6 +352,12 @@ SECTION_FUNC(TEXT, _Swap) ldr r2, =_SCS_ICSR_PENDSV str r2, [r1, #0] +#ifdef CONFIG_KERNEL_V2 + /* load -EAGAIN as the default return value */ + ldr r0, =_k_neg_eagain + ldr r0, [r0] +#endif + /* Unlock interrupts to allow PendSV, since it's running at prio 0xff * * PendSV handler will be called if there are no other interrupts