x86: use CONFIG_PRIVILEGED_STACK_SIZE for stack size

Instead of using CONFIG_MMU_PAGE_SIZE for size of the privileged
stack, use the actual kconfig CONFIG_PRIVILEGED_STACK_SIZE.
This allows for changing the size of privileged stack, and
also aligns to the usage of CONFIG_PRIVILEGED_STACK_SIZE.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-03-04 10:39:03 -08:00 committed by Henrik Brix Andersen
parent 91f36191be
commit 9f4330f365
3 changed files with 8 additions and 1 deletions

View file

@ -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"

View file

@ -11,6 +11,9 @@
#include <ksched.h>
#include <x86_mmu.h>
BUILD_ASSERT((CONFIG_PRIVILEGED_STACK_SIZE > 0) &&
(CONFIG_PRIVILEGED_STACK_SIZE % CONFIG_MMU_PAGE_SIZE) == 0);
#ifdef CONFIG_DEMAND_PAGING
#include <zephyr/kernel/mm/demand_paging.h>
#endif

View file

@ -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);