You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
arch: riscv: Use CONFIG_PMP_SLOTS for M-mode stack guard arrays
The arrays `m_mode_pmpaddr_regs` and `m_mode_pmpcfg_regs` within the
`_thread_arch` struct, used for the M-mode stack guard (when
CONFIG_PMP_STACK_GUARD is enabled), were previously sized using the
hardcoded PMP_M_MODE_SLOTS macro (defined as 8).
This commit changes the array sizing to use the Kconfig option
CONFIG_PMP_SLOTS. This option reflects the total number of Physical
Memory Protection (PMP) slots available and configured for the target
hardware.
This change aligns the M-mode stack guard implementation with the
CONFIG_USERSPACE feature, which already uses CONFIG_PMP_SLOTS for
sizing its PMP-related arrays. Furthermore, using CONFIG_PMP_SLOTS
ensures the size of these arrays is known at compile time, allowing
code in other places, such as drivers/riscv/pmp.c, to safely and
accurately copy or manage these PMP entries when needed.
Signed-off-by: Firas Sammoura <[email protected]>
0 commit comments