Kernel: Big commit. Rewrite ELF loading code

We now load ELF files to VirtualRanges instead of using kmalloc.
We have only a fixed 1 MiB kmalloc for big allocations and this
allows loading files even when they don't fit in there.

This caused me to rewrite the whole ELF loading process since the
loaded ELF is not in memory mapped by every process.

Virtual ranges allow you to zero out the memory and to copy into
them from arbitary byte buffers.
This commit is contained in:
Bananymous
2023-06-09 00:37:43 +03:00
parent 59b10c4d25
commit 801025ad7b
9 changed files with 206 additions and 49 deletions

View File

@@ -23,11 +23,15 @@ namespace Kernel
size_t size() const { return m_size; }
uint8_t flags() const { return m_flags; }
void set_zero();
void copy_from(size_t offset, const uint8_t* buffer, size_t bytes);
private:
VirtualRange(PageTable&);
private:
PageTable& m_page_table;
bool m_kmalloc { false };
vaddr_t m_vaddr { 0 };
size_t m_size { 0 };
uint8_t m_flags { 0 };