Kernel: Rework kernel-side ELF loading

ELFs are now loaded as MemoryRegions so they don't need special handling
anywhere. This also allows file backed COW optimizations to work. This
was not the case before.

This patch removes now obsolete LoadableELF and unused ELF files from
LibElf.
This commit is contained in:
2024-09-15 23:20:32 +03:00
parent 54732edff4
commit a084f83f4c
9 changed files with 300 additions and 1044 deletions

View File

@@ -0,0 +1,18 @@
#pragma once
#include <kernel/FS/Inode.h>
#include <kernel/Memory/MemoryRegion.h>
namespace Kernel::ELF
{
struct LoadResult
{
bool has_interpreter;
vaddr_t entry_point;
BAN::Vector<BAN::UniqPtr<MemoryRegion>> regions;
};
BAN::ErrorOr<LoadResult> load_from_inode(BAN::RefPtr<Inode>, const Credentials&, PageTable&);
}

View File

@@ -22,8 +22,6 @@
#include <sys/time.h>
#include <termios.h>
namespace LibELF { class LoadableELF; }
namespace Kernel
{
@@ -269,7 +267,6 @@ namespace Kernel
OpenFileDescriptorSet m_open_file_descriptors;
BAN::UniqPtr<LibELF::LoadableELF> m_loadable_elf;
BAN::Vector<BAN::UniqPtr<MemoryRegion>> m_mapped_regions;
pid_t m_sid;