Kernel/AK: Move ELF loader to AK

This is in preparation for eventually using it in userspace.
LinearAddress.h has not been moved for the time being (as it seems to be
only used by a very small part of the code).
This commit is contained in:
Robin Burchell 2019-05-23 16:42:13 +02:00 committed by Andreas Kling
parent 5b3c4afff2
commit 6917c42140
8 changed files with 13 additions and 9 deletions

View file

@ -3,7 +3,7 @@
#include <AK/OwnPtr.h>
#include <AK/HashMap.h>
#include <AK/AKString.h>
#include <Kernel/ELF/exec_elf.h>
#include <AK/ELF/exec_elf.h>
class ELFImage {
public:

View file

@ -4,8 +4,10 @@
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#if defined(KERNEL)
#include <Kernel/LinearAddress.h>
#include <Kernel/ELF/ELFImage.h>
#endif
#include <AK/ELF/ELFImage.h>
class ELFLoader {
public:
@ -13,10 +15,12 @@ public:
~ELFLoader();
bool load();
#if defined(KERNEL)
Function<void*(LinearAddress, size_t, size_t, bool, bool, const String&)> alloc_section_hook;
Function<void*(LinearAddress, size_t, size_t, size_t, bool, bool, const String&)> map_section_hook;
char* symbol_ptr(const char* name);
LinearAddress entry() const { return m_image.entry(); }
#endif
char* symbol_ptr(const char* name);
bool has_symbols() const { return m_image.symbol_count(); }

View file

@ -2,7 +2,7 @@
#include "Process.h"
#include "Scheduler.h"
#include <Kernel/FileSystem/FileDescriptor.h>
#include <Kernel/ELF/ELFLoader.h>
#include <AK/ELF/ELFLoader.h>
#include <AK/TemporaryChange.h>
static KSym* s_ksyms;

View file

@ -31,8 +31,6 @@ KERNEL_OBJS = \
FileSystem/FIFO.o \
Scheduler.o \
DoubleBuffer.o \
ELF/ELFImage.o \
ELF/ELFLoader.o \
KSyms.o \
SharedMemory.o \
FileSystem/DevPtsFS.o \
@ -78,7 +76,9 @@ AK_OBJS = \
../AK/StringBuilder.o \
../AK/StringView.o \
../AK/FileSystemPath.o \
../AK/StdLibExtras.o
../AK/StdLibExtras.o \
../AK/ELF/ELFImage.o \
../AK/ELF/ELFLoader.o
CXX_OBJS = $(KERNEL_OBJS) $(VFS_OBJS) $(AK_OBJS)
OBJS = $(CXX_OBJS) Boot/boot.ao

View file

@ -6,7 +6,6 @@
#include <Kernel/FileSystem/FileDescriptor.h>
#include <Kernel/FileSystem/VirtualFileSystem.h>
#include <Kernel/Devices/NullDevice.h>
#include <Kernel/ELF/ELFLoader.h>
#include <Kernel/VM/MemoryManager.h>
#include "i8253.h"
#include "RTC.h"
@ -19,7 +18,8 @@
#include "KSyms.h"
#include <Kernel/Net/Socket.h>
#include <Kernel/TTY/MasterPTY.h>
#include <Kernel/ELF/exec_elf.h>
#include <AK/ELF/exec_elf.h>
#include <AK/ELF/ELFLoader.h>
#include <AK/StringBuilder.h>
#include <AK/Time.h>
#include <Kernel/SharedMemory.h>