When MPU is enabled, the first item in the TCB is not the top of the
stack but the stored context location. As a result, xSecureContext
is located at a negative offset from that position rather than at
offset 0. The current implementation unconditionally reads
xSecureContext at offset 0, which returns an incorrect value when MPU
is enabled.
This commit updates vPortFreeSecureContext to read xSecureContext at
the correcct offset based on the port configuration:
- CM33/CM35P/CM52/CM55/CM85/STAR_MC3: -20 (or -36 with PAC enabled)
- CM23: -20 (no PAC support)
- Without MPU: 0 (xSecureContext remains at the top of stack)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Validate that ulSecureStackSize + securecontextSTACK_SEAL_SIZE does not
overflow before calling pvPortMalloc in the ARMv8-M secure context ports.
Reported by Jordan Mecom (Block, Inc.)
* ARMv8-M: Add SMP support to CM33 NTZ non-MPU port
* Enable SMP for Arm Cortex-M33 NTZ port for
GCC, ArmClang, and IAR toolchains.
* Add per-core scheduler/port state: critical nesting.
* Introduce spinlocks and inter-core yield/wakeup (SEV/WFE) plus
primary/secondary core bring-up sync.
* Update PendSV (i.e., context switch assembly) for core-safe
preemption and restore paths.
* Extend port macros/hooks for SMP in portmacrocommon.h,
single-core builds remain unchanged.
* Add the SMP boot sequence along with the necessary steps to enable
SMP on Armv8-M based ports. This should help developers understand
the requirements and process for enabling SMP on their
Armv8-M based applications.
* Update the kernel checker script to accept comma separated years
in the copyright header.
Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com>
* Armv8-M: Copy SMP changes to all Armv8-M based ports
This commit executes the `copy_files.py` python script
to copy the changes applied in the previous commit
(i.e., SMP changes) to all the Armv8-M based ports.
Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com>
---------
Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com>