Skip to content
Permalink
Browse files

arch: arm: introduce macro to describe the privilege stack alignment

We introduce a new define to describe the alignment for a
privilege stack buffer. This macro definition is used by the
privilege stack generation script, to determine the required
alignment of threads' privilege stacks when building with
support for user mode.

We cannot use Z_THREAD_MIN_STACK_ALIGN in this case, because
the privilege stacks do not need to respect the minimum MPU
region alignment requirement, unless, of course, this is
enforced via the MPU Stack Guard feature.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg authored and andrewboie committed Jun 13, 2019
1 parent e0db394 commit 518bfa39e349477fffd687cb3fda3deb7ccd47fa
Showing with 15 additions and 0 deletions.
  1. +15 −0 include/arch/arm/arch.h
@@ -155,6 +155,21 @@ extern "C" {
*/
#define STACK_ALIGN MAX(Z_THREAD_MIN_STACK_ALIGN, Z_MPU_GUARD_ALIGN)

/**
* @brief Define alignment of a privilege stack buffer
*
* This is used to determine the required alignment of threads'
* privilege stacks when building with support for user mode.
*
* @note
* The privilege stacks do not need to respect the minimum MPU
* region alignment requirement (unless this is enforced via
* the MPU Stack Guard feature).
*/
#if defined(CONFIG_USERSPACE)
#define Z_PRIVILEGE_STACK_ALIGN MAX(STACK_ALIGN_SIZE, Z_MPU_GUARD_ALIGN)
#endif

/**
* @brief Calculate power of two ceiling for a buffer size input
*

0 comments on commit 518bfa3

Please sign in to comment.
You can’t perform that action at this time.