ARCH_ADDRENV: Add guard against mis-configuration

When process a is switched to process b, the address environment is
swapped with a call to group_addrenv(). The stack upon entry will be
a's, and upon exit b's. This will fail, so a neutral stack is required,
either a kernel stack or an IRQ stack.

Infrastructure for an IRQ stack is already in place, so give a hint
that an interrupt stack should be provided if address environments
are enabled.
This commit is contained in:
Ville Juven 2022-03-31 14:59:06 +03:00 committed by Xiang Xiao
parent 840ba09b24
commit e6d6734db2

View File

@ -27,6 +27,25 @@
#include "riscv_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Using address environments currently require that a common interrupt stack
* is in place. This is needed because during context switch the procedure
* that swaps the active address environment is dependent on a stack, which
* must be a 'neutral' stack.
*
* Another option would be to use a per-process kernel stack, but full
* support for this is not yet in place, so use the common IRQ stack instead.
*/
#ifdef CONFIG_ARCH_ADDRENV
# if CONFIG_ARCH_INTERRUPTSTACK == 0 && !defined(CONFIG_ARCH_KERNEL_STACK)
# error "IRQ or kernel stack is needed for swapping address environments"
# endif
#endif
/****************************************************************************
* Public Symbols
****************************************************************************/