Skip to content

Commit e063ba1

Browse files
ioannisgnashif
authored andcommitted
arm: aarch32: introduce status bit-flag for the MPU region width
Introduce an additional single-bit flag to hold the current length of the MPU Stack Guard size (long or default) for the case when building with MPU_STACK_GUARD and FPU_SHARING, in Cortex-M platforms. In addition, the commit adds some documentation about the existing status flags in Arm's thread arch.mode variable. Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent 86c1b57 commit e063ba1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

include/arch/arm/aarch32/thread.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,33 @@ struct _thread_arch {
7575
#endif
7676

7777
#if defined(CONFIG_USERSPACE) || defined(CONFIG_FPU_SHARING)
78+
/*
79+
* Status variable holding several thread status flags
80+
* as follows:
81+
*
82+
* +--------------bit-3----------bit-2--------bit-1---+----bit-0------+
83+
* : | | | | |
84+
* : reserved |<Guard FLOAT>| <FP context> | reserved | <priv mode> |
85+
* : bits | | CONTROL.FPCA | | CONTROL.nPRIV |
86+
* +------------------------------------------------------------------+
87+
*
88+
* Bit 0: thread's current privileged mode (Supervisor or User mode)
89+
* Mirrors CONTROL.nPRIV flag.
90+
* Bit 2: indicating whether the thread has an active FP context.
91+
* Mirrors CONTROL.FPCA flag.
92+
* Bit 3: indicating whether the thread is applying the long (FLOAT)
93+
* or the default MPU stack guard size.
94+
*/
7895
uint32_t mode;
7996
#if defined(CONFIG_USERSPACE)
8097
uint32_t priv_stack_start;
8198
#endif
8299
#endif
83100
};
84101

102+
#if defined(CONFIG_FPU_SHARING) && defined(CONFIG_MPU_STACK_GUARD)
103+
#define Z_ARM_MODE_MPU_GUARD_FLOAT_Msk (1 << 3)
104+
#endif
85105
typedef struct _thread_arch _thread_arch_t;
86106

87107
#endif /* _ASMLANGUAGE */

0 commit comments

Comments
 (0)