kernel: introduce supervisor-only stacks
These stacks are appropriate for threads that run purely in supervisor mode, and also as stacks for interrupt and exception handling. Two new arch defines are introduced: - ARCH_KERNEL_STACK_GUARD_SIZE - ARCH_KERNEL_STACK_OBJ_ALIGN New public declaration macros: - K_KERNEL_STACK_RESERVED - K_KERNEL_STACK_EXTERN - K_KERNEL_STACK_DEFINE - K_KERNEL_STACK_ARRAY_DEFINE - K_KERNEL_STACK_MEMBER - K_KERNEL_STACK_SIZEOF If user mode is not enabled, K_KERNEL_STACK_* and K_THREAD_STACK_* are equivalent. Separately generated privilege elevation stacks are now declared like kernel stacks, removing the need for K_PRIVILEGE_STACK_ALIGN. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
c7f33a7759
commit
8ce260d8df
21 changed files with 414 additions and 143 deletions
|
@ -24,13 +24,7 @@ void arch_new_thread(struct k_thread *thread, k_thread_stack_t *stack,
|
|||
struct x86_initial_frame *iframe;
|
||||
|
||||
#if CONFIG_X86_STACK_PROTECTION
|
||||
struct z_x86_thread_stack_header *header =
|
||||
(struct z_x86_thread_stack_header *)stack;
|
||||
|
||||
/* Set guard area to read-only to catch stack overflows */
|
||||
z_x86_mmu_set_flags(&z_x86_kernel_ptables, &header->guard_page,
|
||||
MMU_PAGE_SIZE, MMU_ENTRY_READ, Z_X86_MMU_RW,
|
||||
true);
|
||||
z_x86_set_stack_guard(stack);
|
||||
#endif
|
||||
#ifdef CONFIG_USERSPACE
|
||||
switch_entry = z_x86_userspace_prepare_thread(thread);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue