arm: cortex-m: minor doc updates in swap_helper.S
Inline some minor clarifications regarding the
Lazy Stacking feature in the cortex-m pendSV
handler, for ease of understanding. Also, fix
some minor style issues in comments.
Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
diff --git a/arch/arm/core/aarch32/swap_helper.S b/arch/arm/core/aarch32/swap_helper.S
index cfdd743..eb0684c 100644
--- a/arch/arm/core/aarch32/swap_helper.S
+++ b/arch/arm/core/aarch32/swap_helper.S
@@ -65,7 +65,7 @@
#else
pop {r0, lr}
#endif /* CONFIG_ARMV6_M_ARMV8_M_BASELINE */
-#endif /* CONFIG_TRACING */
+#endif /* CONFIG_INSTRUMENT_THREAD_SWITCHING */
/* load _kernel into r1 and current k_thread into r2 */
ldr r1, =_kernel
@@ -104,7 +104,11 @@
b out_fp_endif
out_fp_active:
- /* FP context active: set FP state and store callee-saved registers */
+ /* FP context active: set FP state and store callee-saved registers.
+ * Note: if Lazy FP stacking is enabled, storing the callee-saved
+ * registers will automatically trigger FP state preservation in
+ * the thread's stack. This will also clear the FPCCR.LSPACT flag.
+ */
add r0, r2, #_thread_offset_to_preempt_float
vstmia r0, {s16-s31}
ldr r0, [r2, #_thread_offset_to_mode]
@@ -112,6 +116,9 @@
out_fp_endif:
str r0, [r2, #_thread_offset_to_mode]
+ /* At this point FPCCR.LSPACT is guaranteed to be cleared,
+ * regardless of whether the thread has an active FP context.
+ */
#endif /* CONFIG_FPU_SHARING */
#elif defined(CONFIG_ARMV7_R)
/* Store rest of process context */
@@ -376,7 +383,7 @@
#else
pop {r0, lr}
#endif
-#endif /* CONFIG_TRACING */
+#endif /* CONFIG_INSTRUMENT_THREAD_SWITCHING */
/*
* Cortex-M: return from PendSV exception