summaryrefslogtreecommitdiff
path: root/Kernel/Task.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-27 14:56:52 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-27 14:56:52 +0200
commit9a71c7759a0684a52d2e5619a2312bc8da7b11da (patch)
treede166ed9d8c0230e640e62985f0dbb90fbb02447 /Kernel/Task.h
parent99ee6acd69205844daf82a3b7c35aa0f766f8bbc (diff)
downloadserenity-9a71c7759a0684a52d2e5619a2312bc8da7b11da.zip
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!
Diffstat (limited to 'Kernel/Task.h')
-rw-r--r--Kernel/Task.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/Kernel/Task.h b/Kernel/Task.h
index 495dbde41c..c683f50088 100644
--- a/Kernel/Task.h
+++ b/Kernel/Task.h
@@ -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;