Compare commits

...

2 Commits

Author SHA1 Message Date
71b981175e
InitRD: Use MMU::translate_physical_address instead of allocating VM
All checks were successful
continuous-integration/drone/push Build is passing
This one is a perfect candidate, since we're just mapping a fixed continuous range of physical memory to virtual memory.
2023-02-27 13:27:21 +01:00
f0a3f99cf9
MemoryManager: Initialize KernelVM at the end of init()
KernelVM is not needed for MMU's init process anymore.
2023-02-27 13:24:58 +01:00
2 changed files with 4 additions and 7 deletions

View File

@ -1,18 +1,13 @@
#include "InitRD.h" #include "InitRD.h"
#include "arch/MMU.h" #include "arch/MMU.h"
#include "boot/bootboot.h" #include "boot/bootboot.h"
#include "memory/MemoryManager.h"
#include <luna/Alignment.h>
TarStream g_initrd; TarStream g_initrd;
extern const BOOTBOOT bootboot; extern const BOOTBOOT bootboot;
void InitRD::initialize() void InitRD::initialize()
{ {
u64 virtual_initrd_address = u64 virtual_initrd_address = MMU::translate_physical_address(bootboot.initrd_ptr);
MemoryManager::get_kernel_mapping_for_frames(
bootboot.initrd_ptr, get_blocks_from_size(bootboot.initrd_size, ARCH_PAGE_SIZE), MMU::NoExecute)
.expect_value("Unable to map the initial ramdisk into virtual memory");
g_initrd.initialize((void*)virtual_initrd_address, bootboot.initrd_size); g_initrd.initialize((void*)virtual_initrd_address, bootboot.initrd_size);
} }

View File

@ -100,7 +100,7 @@ namespace MemoryManager
void init() void init()
{ {
init_physical_frame_allocator(); init_physical_frame_allocator();
KernelVM::init();
MMU::setup_initial_page_directory(); MMU::setup_initial_page_directory();
auto frame_bitmap = g_frame_bitmap.lock(); auto frame_bitmap = g_frame_bitmap.lock();
@ -108,6 +108,8 @@ namespace MemoryManager
auto virtual_bitmap_base = MMU::translate_physical_address(phys); auto virtual_bitmap_base = MMU::translate_physical_address(phys);
frame_bitmap->initialize((void*)virtual_bitmap_base, frame_bitmap->size_in_bytes()); frame_bitmap->initialize((void*)virtual_bitmap_base, frame_bitmap->size_in_bytes());
KernelVM::init();
} }
void do_lock_frame(u64 index, Bitmap& bitmap) void do_lock_frame(u64 index, Bitmap& bitmap)