_Actually_ move the kernel to the last TiB.
More work on process page tables, including only mapping the last 2 pml4 entries (the highest 1TiB of the address space, ie, kernel space) into a new table. Includes the work of actually moving the kernel there, which I had apparently done in name only previously. Oops.
This commit is contained in:
@@ -113,6 +113,7 @@ tss_set_entry(uint8_t i, uint64_t base, uint64_t limit)
|
||||
tssd.base_16 = (base >> 16) & 0xff;
|
||||
tssd.base_24 = (base >> 24) & 0xff;
|
||||
tssd.base_32 = (base >> 32) & 0xffffffff;
|
||||
tssd.reserved = 0;
|
||||
|
||||
tssd.type =
|
||||
gdt_type::accessed |
|
||||
|
||||
@@ -84,7 +84,6 @@ kernel_main(popcorn_data *header)
|
||||
header->frame_buffer_length);
|
||||
|
||||
init_console(header);
|
||||
// pager->dump_blocks();
|
||||
|
||||
device_manager *devices =
|
||||
new (&device_manager::get()) device_manager(header->acpi_table);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "page_manager.h"
|
||||
|
||||
const unsigned efi_page_size = 0x1000;
|
||||
const unsigned ident_page_flags = 0xf; // TODO: set to 0xb when user/kernel page tables are better sorted
|
||||
const unsigned ident_page_flags = 0xb;
|
||||
|
||||
enum class efi_memory_type : uint32_t
|
||||
{
|
||||
@@ -436,7 +436,7 @@ memory_initialize(const void *memory_map, size_t map_length, size_t desc_length)
|
||||
|
||||
// Offset-map this region into the higher half.
|
||||
uint64_t free_region_start_virt =
|
||||
free_region_start_phys + page_manager::high_offset;
|
||||
free_region_start_phys + page_manager::page_offset;
|
||||
|
||||
uint64_t free_next = free_region_start_virt;
|
||||
|
||||
|
||||
@@ -227,7 +227,10 @@ page_table *
|
||||
page_manager::create_process_map()
|
||||
{
|
||||
page_table *table = get_table_page();
|
||||
kutil::memcpy(table, m_kernel_pml4, page_size);
|
||||
|
||||
kutil::memset(table, 0, page_size);
|
||||
table->entries[510] = m_kernel_pml4->entries[510];
|
||||
table->entries[511] = m_kernel_pml4->entries[511];
|
||||
|
||||
// Create the initial user stack
|
||||
map_pages(
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
static const size_t page_size = 0x1000;
|
||||
|
||||
/// Start of the higher half.
|
||||
static const addr_t high_offset = 0xffff800000000000;
|
||||
static const addr_t high_offset = 0xffffff0000000000;
|
||||
|
||||
/// Offset from physical where page tables are mapped.
|
||||
static const addr_t page_offset = 0xffffff8000000000;
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include "scheduler.h"
|
||||
|
||||
scheduler scheduler::s_instance(nullptr);
|
||||
static const uint32_t quantum = 2000000;
|
||||
//static const uint32_t quantum = 2000000;
|
||||
static const uint32_t quantum = 20000000;
|
||||
|
||||
const int stack_size = 0x1000;
|
||||
|
||||
@@ -42,7 +43,7 @@ create_process(uint16_t pid, void (*rip)())
|
||||
|
||||
state->ds = state->ss = ss;
|
||||
state->cs = cs;
|
||||
state->rflags = 0x202; // testing. TODO: 0x202
|
||||
state->rflags = 0x202;
|
||||
state->rip = reinterpret_cast<uint64_t>(rip);
|
||||
|
||||
page_table *pml4 = page_manager::get()->create_process_map();
|
||||
|
||||
Reference in New Issue
Block a user