#pragma once #include #include #include #include #include class ELFLoader; class ExecSpace { public: struct Area { Area(String&& n, char* m, unsigned s) : name(move(n)) , memory(m) , size(s) { } String name; char* memory { 0 }; unsigned size { 0 }; }; struct PtrAndSize { PtrAndSize() { } PtrAndSize(char* p, unsigned s) : ptr(p) , size(s) { } char* ptr { nullptr }; unsigned size { 0 }; }; ExecSpace(); ~ExecSpace(); Function hookableAlloc; #ifdef SERENITY bool loadELF(ByteBuffer&&); #else bool loadELF(MappedFile&&); #endif char* symbolPtr(const char* name); char* allocateArea(String&& name, unsigned size); void addSymbol(String&& name, char* ptr, unsigned size); private: void initializeBuiltins(); Vector> m_areas; HashMap m_symbols; };