arch: enable ARCH_KERNEL_STACK support in protected builds

Expand ARCH_KERNEL_STACK configuration to support both BUILD_KERNEL and
BUILD_PROTECTED modes. Change Kconfig dependency from "depends on BUILD_KERNEL"
to "depends on BUILD_KERNEL || BUILD_PROTECTED". Update pthread_create.c to
remove redundant BUILD_KERNEL check when allocating kernel stacks with
CONFIG_ARCH_KERNEL_STACK enabled. Enables protected builds to use separate
kernel and user stacks for processes.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-05-06 18:32:18 +08:00
committed by GUIDINGLI
parent 835c9c0f77
commit a9d9dd2120
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -907,7 +907,7 @@ endif # ARCH_STACK_DYNAMIC
config ARCH_KERNEL_STACK
bool "Kernel process stack"
default LIBC_EXECFUNCS
depends on BUILD_KERNEL
depends on BUILD_KERNEL || BUILD_PROTECTED
---help---
It this option is selected, then every user process will have two
stacks: A large, potentially dynamically sized user stack and small
+1 -2
View File
@@ -273,8 +273,7 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
goto errout_with_tcb;
}
#if defined(CONFIG_ARCH_ADDRENV) && \
defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_ARCH_KERNEL_STACK)
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_ARCH_KERNEL_STACK)
/* Allocate the kernel stack */
ret = up_addrenv_kstackalloc(ptcb);