mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[memory] Rework memory_initialize for new loader
Created a new `memory_initialize()` function that uses the new-style kernel args structure from the new bootloader. Additionally: * Fixed a hard-coded interrupt EOI address that didn't work with new memory locations * Make the `page_manager::fault_handler()` automatically grant pages in the kernel heap Tags: boot page fault
This commit is contained in:
@@ -15,7 +15,7 @@ using memory::page_offset;
|
||||
using memory::page_mappable;
|
||||
|
||||
page_manager g_page_manager(g_frame_allocator);
|
||||
extern kutil::vm_space g_kspace;
|
||||
extern kutil::vm_space g_kernel_space;
|
||||
|
||||
// NB: in 4KiB page table entries, bit 7 isn't pagesize but PAT. Currently this
|
||||
// doesn't matter, becasue in the default PAT table, both 000 and 100 are WB.
|
||||
@@ -47,8 +47,7 @@ struct free_page_header
|
||||
|
||||
page_manager::page_manager(frame_allocator &frames) :
|
||||
m_page_cache(nullptr),
|
||||
m_frames(frames),
|
||||
m_memory_initialized(false)
|
||||
m_frames(frames)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -322,8 +321,11 @@ page_manager::fault_handler(uintptr_t addr)
|
||||
if (!addr)
|
||||
return false;
|
||||
|
||||
if (m_memory_initialized &&
|
||||
g_kspace.get(addr) != kutil::vm_state::committed)
|
||||
bool is_heap = addr >= ::memory::heap_start &&
|
||||
addr < ::memory::heap_start + ::memory::kernel_max_heap;
|
||||
|
||||
if (!is_heap &&
|
||||
g_kernel_space.get(addr) != kutil::vm_state::committed)
|
||||
return false;
|
||||
|
||||
uintptr_t page = addr & ~0xfffull;
|
||||
|
||||
Reference in New Issue
Block a user