x86: add support for memory mapped stack for threads

This adds the necessary bits to enable memory mapping thread
stacks on both x86 and x86_64. Note that currently these do
not support multi level mappings (e.g. demand paging and
running in virtual address space: qemu_x86/atom/virt board)
as the mapped stacks require actual physical addresses.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2024-04-01 13:05:43 -07:00 committed by Anas Nashif
commit 027a1c30cd
8 changed files with 87 additions and 6 deletions

View file

@ -32,7 +32,10 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
void *switch_entry;
struct x86_initial_frame *iframe;
#if CONFIG_X86_STACK_PROTECTION
#if defined(CONFIG_X86_STACK_PROTECTION) && !defined(CONFIG_THREAD_STACK_MEM_MAPPED)
/* This unconditionally set the first page of stack as guard page,
* which is only needed if the stack is not memory mapped.
*/
z_x86_set_stack_guard(stack);
#endif
#ifdef CONFIG_USERSPACE