x86: abstract toplevel page table pointer
This patch is a preparatory step in enabling the MMU in long mode; no steps are taken to implement long mode support. We introduce struct x86_page_tables, which represents the top-level data structure for page tables: - For 32-bit, this will contain a four-entry page directory pointer table (PDPT) - For 64-bit, this will (eventually) contain a page map level 4 table (PML4) In either case, this pointer value is what gets programmed into CR3 to activate a set of page tables. There are extra bits in CR3 to set for long mode, we'll get around to that later. This abstraction will allow us to use the same APIs that work with page tables in either mode, rather than hard-coding that the top level data structure is a PDPT. z_x86_mmu_validate() has been re-written to make it easier to add another level of paging for long mode, to support 2MB PDPT entries, and correctly validate regions which span PDPTE entries. Some MMU-related APIs moved out of 32-bit x86's arch.h into mmustructs.h. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
ad708306c0
commit
f0ddbd7eee
11 changed files with 309 additions and 267 deletions
|
@ -77,15 +77,16 @@ extern FUNC_NORETURN void z_x86_userspace_enter(k_thread_entry_t user_entry,
|
|||
|
||||
void z_x86_thread_pt_init(struct k_thread *thread);
|
||||
|
||||
void z_x86_apply_mem_domain(struct x86_mmu_pdpt *pdpt,
|
||||
void z_x86_apply_mem_domain(struct x86_page_tables *ptables,
|
||||
struct k_mem_domain *mem_domain);
|
||||
|
||||
static inline struct x86_mmu_pdpt *z_x86_pdpt_get(struct k_thread *thread)
|
||||
static inline struct x86_page_tables *
|
||||
z_x86_thread_page_tables_get(struct k_thread *thread)
|
||||
{
|
||||
struct z_x86_thread_stack_header *header =
|
||||
(struct z_x86_thread_stack_header *)thread->stack_obj;
|
||||
|
||||
return &header->kernel_data.pdpt;
|
||||
return &header->kernel_data.ptables;
|
||||
}
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue