6#ifndef ZEPHYR_INCLUDE_ARCH_X86_THREAD_STACK_H
7#define ZEPHYR_INCLUDE_ARCH_X86_THREAD_STACK_H
12#define ARCH_STACK_PTR_ALIGN 16UL
14#define ARCH_STACK_PTR_ALIGN 4UL
17#if defined(CONFIG_HW_STACK_PROTECTION) || defined(CONFIG_USERSPACE)
18#define Z_X86_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
20#define Z_X86_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
23#ifdef CONFIG_USERSPACE
28#define Z_X86_STACK_SIZE_ALIGN CONFIG_MMU_PAGE_SIZE
30#define Z_X86_STACK_SIZE_ALIGN ARCH_STACK_PTR_ALIGN
64struct z_x86_thread_stack_header {
65#ifdef CONFIG_HW_STACK_PROTECTION
66 char guard_page[CONFIG_MMU_PAGE_SIZE];
68#ifdef CONFIG_USERSPACE
69 char privilege_stack[CONFIG_MMU_PAGE_SIZE];
71} __packed __aligned(Z_X86_STACK_BASE_ALIGN);
73#define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_X86_STACK_BASE_ALIGN
75#define ARCH_THREAD_STACK_SIZE_ADJUST(size) \
76 ROUND_UP((size), Z_X86_STACK_SIZE_ALIGN)
78#define ARCH_THREAD_STACK_RESERVED \
79 sizeof(struct z_x86_thread_stack_header)
81#ifdef CONFIG_HW_STACK_PROTECTION
82#define ARCH_KERNEL_STACK_RESERVED CONFIG_MMU_PAGE_SIZE
83#define ARCH_KERNEL_STACK_OBJ_ALIGN CONFIG_MMU_PAGE_SIZE
85#define ARCH_KERNEL_STACK_RESERVED 0
86#define ARCH_KERNEL_STACK_OBJ_ALIGN ARCH_STACK_PTR_ALIGN