riscv: clarify stack size and alignment parameters

The StackGuard area is used to save the esf and run the exception code
resulting from a StackGuard trap. Size it appropriately.

Remove redundancy, clarify documentation, etc.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2022-04-30 15:12:31 -04:00 committed by Carles Cufí
commit 6051ea7d3c
5 changed files with 63 additions and 111 deletions

View file

@ -217,12 +217,11 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
_current->arch.priv_stack_start =
(ulong_t)z_priv_stack_find(_current->stack_obj);
#else
_current->arch.priv_stack_start =
(ulong_t)(_current->stack_obj) +
Z_RISCV_STACK_GUARD_SIZE;
_current->arch.priv_stack_start = (ulong_t)_current->stack_obj;
#endif /* CONFIG_GEN_PRIV_STACKS */
top_of_priv_stack = Z_STACK_PTR_ALIGN(_current->arch.priv_stack_start
+ CONFIG_PRIVILEGED_STACK_SIZE);
top_of_priv_stack = Z_STACK_PTR_ALIGN(_current->arch.priv_stack_start +
K_KERNEL_STACK_RESERVED +
CONFIG_PRIVILEGED_STACK_SIZE);
top_of_user_stack = Z_STACK_PTR_ALIGN(
_current->stack_info.start +