x86: use a struct to specify stack layout

Makes the code that defines stacks, and code referencing
areas within the stack object, much clearer.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-08-01 15:06:40 -07:00 committed by Carles Cufí
commit 0add92523c
4 changed files with 61 additions and 46 deletions

View file

@ -89,9 +89,10 @@ void z_x86_apply_mem_domain(struct x86_mmu_pdpt *pdpt,
static inline struct x86_mmu_pdpt *z_x86_pdpt_get(struct k_thread *thread)
{
uintptr_t addr = thread->stack_info.start;
struct z_x86_thread_stack_header *header =
(struct z_x86_thread_stack_header *)thread->stack_obj;
return (struct x86_mmu_pdpt *)(addr - sizeof(struct x86_mmu_pdpt));
return &header->kernel_data.pdpt;
}
#endif /* CONFIG_USERSPACE */
#include <stddef.h> /* For size_t */