[boot] Set up initial page tables

Set up initial page tables for both the offset-mapped area and the
loaded kernel code and data.

* Got rid of the `loaded_elf` struct - the loader now runs after the
  initial PML4 is created and maps the ELF sections itself.
* Copied in the `page_table` and `page_table_indices` from the kernel,
  still need to clean this up and extract it into shared code.
* Added `page_table_cache` to the kernel args to pass along free pages
  that can be used for initial page tables.

Tags: paging
This commit is contained in:
Justin C. Miller
2020-05-17 22:03:44 -07:00
parent c9722a07f3
commit 4f4a35a7be
8 changed files with 263 additions and 67 deletions

View File

@@ -22,6 +22,7 @@ enum class mod_type : uint32_t {
initrd,
memory_map,
page_tables,
framebuffer,
max
@@ -72,7 +73,10 @@ struct header {
uint8_t _reserved0;
uint32_t _reserved1;
void *pml4;
void *page_table_cache;
uint32_t num_free_tables;
uint32_t num_modules;
module *modules;