diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1c58de4b90..487d6e94bd 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -489,6 +489,10 @@ config X86_EFI_CONSOLE Likewise be sure to disable any other console/printk drivers! +config PRIVILEGED_STACK_SIZE + # Must be multiple of CONFIG_MMU_PAGE_SIZE + default 4096 if X86_MMU + source "arch/x86/core/Kconfig.ia32" source "arch/x86/core/Kconfig.intel64" diff --git a/arch/x86/core/userspace.c b/arch/x86/core/userspace.c index 9380c14d00..750c977594 100644 --- a/arch/x86/core/userspace.c +++ b/arch/x86/core/userspace.c @@ -11,6 +11,9 @@ #include #include +BUILD_ASSERT((CONFIG_PRIVILEGED_STACK_SIZE > 0) && + (CONFIG_PRIVILEGED_STACK_SIZE % CONFIG_MMU_PAGE_SIZE) == 0); + #ifdef CONFIG_DEMAND_PAGING #include #endif diff --git a/include/zephyr/arch/x86/thread_stack.h b/include/zephyr/arch/x86/thread_stack.h index 5808d8bd99..a92b04846d 100644 --- a/include/zephyr/arch/x86/thread_stack.h +++ b/include/zephyr/arch/x86/thread_stack.h @@ -66,7 +66,7 @@ struct z_x86_thread_stack_header { char guard_page[CONFIG_MMU_PAGE_SIZE]; #endif #ifdef CONFIG_USERSPACE - char privilege_stack[CONFIG_MMU_PAGE_SIZE]; + char privilege_stack[CONFIG_PRIVILEGED_STACK_SIZE]; #endif /* CONFIG_USERSPACE */ } __packed __aligned(Z_X86_STACK_BASE_ALIGN);