riscv: drop user stack guard area when using separate privileged stacks
A separate privileged stack is used when CONFIG_GEN_PRIV_STACKS=y. The main stack guard area is no longer needed and can be made available to the application upon transitioning to user mode. And that's actually required if we want a naturally aligned power-of-two buffer to let the PMP map a NAPOT entry on it which is the whole point of having this CONFIG_PMP_POWER_OF_TWO_ALIGNMENT option in the first place. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
6051ea7d3c
commit
92409f36de
2 changed files with 19 additions and 1 deletions
|
@ -216,6 +216,9 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
|
|||
#ifdef CONFIG_GEN_PRIV_STACKS
|
||||
_current->arch.priv_stack_start =
|
||||
(ulong_t)z_priv_stack_find(_current->stack_obj);
|
||||
/* remove the stack guard from the main stack */
|
||||
_current->stack_info.start -= K_THREAD_STACK_RESERVED;
|
||||
_current->stack_info.size += K_THREAD_STACK_RESERVED;
|
||||
#else
|
||||
_current->arch.priv_stack_start = (ulong_t)_current->stack_obj;
|
||||
#endif /* CONFIG_GEN_PRIV_STACKS */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue