mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +00:00
Implement loading of linked ELF executables.
This took me a couple hours. :^) The ELF loading code now allocates a single region for the entire file and creates virtual memory mappings for the sections as needed. Very nice!
This commit is contained in:
parent
99ee6acd69
commit
9a71c7759a
Notes:
sideshowbarker
2024-07-19 18:37:37 +09:00
Author: https://github.com/awesomekling
Commit: 9a71c7759a
16 changed files with 258 additions and 57 deletions
|
@ -112,7 +112,7 @@ public:
|
|||
static void taskDidCrash(Task*);
|
||||
|
||||
size_t regionCount() const { return m_regions.size(); }
|
||||
const Vector<OwnPtr<Region>>& regions() const { return m_regions; }
|
||||
const Vector<RetainPtr<Region>>& regions() const { return m_regions; }
|
||||
void dumpRegions();
|
||||
|
||||
void didSchedule() { ++m_timesScheduled; }
|
||||
|
@ -166,7 +166,7 @@ private:
|
|||
|
||||
RetainPtr<VirtualFileSystem::Node> m_cwd;
|
||||
|
||||
struct Region {
|
||||
struct Region : public Retainable<Region> {
|
||||
Region(LinearAddress, size_t, RetainPtr<Zone>&&, String&&);
|
||||
~Region();
|
||||
LinearAddress linearAddress;
|
||||
|
@ -174,12 +174,26 @@ private:
|
|||
RetainPtr<Zone> zone;
|
||||
String name;
|
||||
};
|
||||
|
||||
struct Subregion {
|
||||
Subregion(Region&, dword offset, size_t, LinearAddress, String&& name);
|
||||
~Subregion();
|
||||
|
||||
RetainPtr<Region> region;
|
||||
dword offset;
|
||||
size_t size { 0 };
|
||||
LinearAddress linearAddress;
|
||||
String name;
|
||||
};
|
||||
|
||||
Region* allocateRegion(size_t, String&& name);
|
||||
Region* allocateRegion(size_t, String&& name, LinearAddress);
|
||||
bool deallocateRegion(Region& region);
|
||||
|
||||
Region* regionFromRange(LinearAddress, size_t);
|
||||
|
||||
Vector<OwnPtr<Region>> m_regions;
|
||||
Vector<RetainPtr<Region>> m_regions;
|
||||
Vector<OwnPtr<Subregion>> m_subregions;
|
||||
|
||||
// FIXME: Implement some kind of ASLR?
|
||||
LinearAddress m_nextRegion;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue