From 533cfa18fa78623e4f5413427f244601e722c2ac Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Mon, 11 Feb 2019 11:07:58 +0100 Subject: [PATCH] arch: arm: update function documentation for __svc Fixing the documentation for ARM core __svc function, which was outdated and present only for the ARMv7-M version. Signed-off-by: Ioannis Glaropoulos --- arch/arm/core/swap.c | 2 +- arch/arm/core/swap_helper.S | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/arm/core/swap.c b/arch/arm/core/swap.c index f0de57d22f8..310dd1faa26 100644 --- a/arch/arm/core/swap.c +++ b/arch/arm/core/swap.c @@ -36,7 +36,7 @@ extern const int _k_neg_eagain; * Given that __swap() is called to effect a cooperative context switch, * only the caller-saved integer registers need to be saved in the thread of the * outgoing thread. This is all performed by the hardware, which stores it in - * its exception stack frame, created when handling the svc exception. + * its exception stack frame, created when handling the __pendsv exception. * * On ARMv6-M, the intlock key is represented by the PRIMASK register, * as BASEPRI is not available. diff --git a/arch/arm/core/swap_helper.S b/arch/arm/core/swap_helper.S index 8d1796d4423..e809ecec401 100644 --- a/arch/arm/core/swap_helper.S +++ b/arch/arm/core/swap_helper.S @@ -258,6 +258,17 @@ _thread_irq_disabled: bx lr #if defined(CONFIG_ARMV6_M_ARMV8_M_BASELINE) + +/** + * + * @brief Service call handler + * + * The service call (svc) is used in the following occasions: + * - IRQ offloading + * - Kernel run-time exceptions + * + * @return N/A + */ SECTION_FUNC(TEXT, __svc) /* Use EXC_RETURN state to find out if stack frame is on the * MSP or PSP @@ -305,16 +316,18 @@ _oops: pop {r0, pc} #elif defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) + /** * * @brief Service call handler * - * The service call (svc) is only used in __swap() to enter handler mode so we - * can go through the PendSV exception to perform a context switch. + * The service call (svc) is used in the following occasions: + * - IRQ offloading + * - Kernel run-time exceptions + * - System Calls (User mode) * * @return N/A */ - SECTION_FUNC(TEXT, __svc) tst lr, #0x4 /* did we come from thread mode ? */ ite eq /* if zero (equal), came from handler mode */