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_X86_STACK_PROTECTION) || defined(CONFIG_USERSPACE) \
18 || defined(CONFIG_THREAD_STACK_MEM_MAPPED)
19#define Z_X86_STACK_BASE_ALIGN CONFIG_MMU_PAGE_SIZE
21#define Z_X86_STACK_BASE_ALIGN ARCH_STACK_PTR_ALIGN
24#if defined(CONFIG_USERSPACE) || defined(CONFIG_THREAD_STACK_MEM_MAPPED)
32#define Z_X86_STACK_SIZE_ALIGN CONFIG_MMU_PAGE_SIZE
34#define Z_X86_STACK_SIZE_ALIGN ARCH_STACK_PTR_ALIGN
89struct z_x86_thread_stack_header {
90#if defined(CONFIG_X86_STACK_PROTECTION) && !defined(CONFIG_THREAD_STACK_MEM_MAPPED)
91 char guard_page[CONFIG_MMU_PAGE_SIZE];
93#ifdef CONFIG_USERSPACE
94 char privilege_stack[CONFIG_PRIVILEGED_STACK_SIZE];
96} __packed __aligned(Z_X86_STACK_BASE_ALIGN);
98#define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_X86_STACK_BASE_ALIGN
100#define ARCH_THREAD_STACK_SIZE_ADJUST(size) \
101 ROUND_UP((size), Z_X86_STACK_SIZE_ALIGN)
103#define ARCH_THREAD_STACK_RESERVED \
104 sizeof(struct z_x86_thread_stack_header)
106#ifdef CONFIG_X86_STACK_PROTECTION
107#define ARCH_KERNEL_STACK_RESERVED CONFIG_MMU_PAGE_SIZE
108#define ARCH_KERNEL_STACK_OBJ_ALIGN CONFIG_MMU_PAGE_SIZE
110#define ARCH_KERNEL_STACK_RESERVED 0
111#define ARCH_KERNEL_STACK_OBJ_ALIGN ARCH_STACK_PTR_ALIGN