InitRD: Use MMU::translate_physical_address instead of allocating VM
Some checks reported errors
continuous-integration/drone/pr Build was killed

This one is a perfect candidate, since we're just mapping a fixed continuous range of physical memory to virtual memory.
This commit is contained in:
apio 2023-02-27 13:27:21 +01:00
parent 3654cc5bee
commit 7f1884213a
Signed by: apio
GPG Key ID: B8A7D06E42258954

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);
} }