mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
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:
parent
5b3c4afff2
commit
6917c42140
|
@ -3,7 +3,7 @@
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/AKString.h>
|
#include <AK/AKString.h>
|
||||||
#include <Kernel/ELF/exec_elf.h>
|
#include <AK/ELF/exec_elf.h>
|
||||||
|
|
||||||
class ELFImage {
|
class ELFImage {
|
||||||
public:
|
public:
|
|
@ -4,8 +4,10 @@
|
||||||
#include <AK/HashMap.h>
|
#include <AK/HashMap.h>
|
||||||
#include <AK/OwnPtr.h>
|
#include <AK/OwnPtr.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
|
#if defined(KERNEL)
|
||||||
#include <Kernel/LinearAddress.h>
|
#include <Kernel/LinearAddress.h>
|
||||||
#include <Kernel/ELF/ELFImage.h>
|
#endif
|
||||||
|
#include <AK/ELF/ELFImage.h>
|
||||||
|
|
||||||
class ELFLoader {
|
class ELFLoader {
|
||||||
public:
|
public:
|
||||||
|
@ -13,10 +15,12 @@ public:
|
||||||
~ELFLoader();
|
~ELFLoader();
|
||||||
|
|
||||||
bool load();
|
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, bool, bool, const String&)> alloc_section_hook;
|
||||||
Function<void*(LinearAddress, size_t, size_t, size_t, bool, bool, const String&)> map_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(); }
|
LinearAddress entry() const { return m_image.entry(); }
|
||||||
|
#endif
|
||||||
|
char* symbol_ptr(const char* name);
|
||||||
|
|
||||||
bool has_symbols() const { return m_image.symbol_count(); }
|
bool has_symbols() const { return m_image.symbol_count(); }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "Process.h"
|
#include "Process.h"
|
||||||
#include "Scheduler.h"
|
#include "Scheduler.h"
|
||||||
#include <Kernel/FileSystem/FileDescriptor.h>
|
#include <Kernel/FileSystem/FileDescriptor.h>
|
||||||
#include <Kernel/ELF/ELFLoader.h>
|
#include <AK/ELF/ELFLoader.h>
|
||||||
#include <AK/TemporaryChange.h>
|
#include <AK/TemporaryChange.h>
|
||||||
|
|
||||||
static KSym* s_ksyms;
|
static KSym* s_ksyms;
|
||||||
|
|
|
@ -31,8 +31,6 @@ KERNEL_OBJS = \
|
||||||
FileSystem/FIFO.o \
|
FileSystem/FIFO.o \
|
||||||
Scheduler.o \
|
Scheduler.o \
|
||||||
DoubleBuffer.o \
|
DoubleBuffer.o \
|
||||||
ELF/ELFImage.o \
|
|
||||||
ELF/ELFLoader.o \
|
|
||||||
KSyms.o \
|
KSyms.o \
|
||||||
SharedMemory.o \
|
SharedMemory.o \
|
||||||
FileSystem/DevPtsFS.o \
|
FileSystem/DevPtsFS.o \
|
||||||
|
@ -78,7 +76,9 @@ AK_OBJS = \
|
||||||
../AK/StringBuilder.o \
|
../AK/StringBuilder.o \
|
||||||
../AK/StringView.o \
|
../AK/StringView.o \
|
||||||
../AK/FileSystemPath.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)
|
CXX_OBJS = $(KERNEL_OBJS) $(VFS_OBJS) $(AK_OBJS)
|
||||||
OBJS = $(CXX_OBJS) Boot/boot.ao
|
OBJS = $(CXX_OBJS) Boot/boot.ao
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
#include <Kernel/FileSystem/FileDescriptor.h>
|
#include <Kernel/FileSystem/FileDescriptor.h>
|
||||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||||
#include <Kernel/Devices/NullDevice.h>
|
#include <Kernel/Devices/NullDevice.h>
|
||||||
#include <Kernel/ELF/ELFLoader.h>
|
|
||||||
#include <Kernel/VM/MemoryManager.h>
|
#include <Kernel/VM/MemoryManager.h>
|
||||||
#include "i8253.h"
|
#include "i8253.h"
|
||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
|
@ -19,7 +18,8 @@
|
||||||
#include "KSyms.h"
|
#include "KSyms.h"
|
||||||
#include <Kernel/Net/Socket.h>
|
#include <Kernel/Net/Socket.h>
|
||||||
#include <Kernel/TTY/MasterPTY.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/StringBuilder.h>
|
||||||
#include <AK/Time.h>
|
#include <AK/Time.h>
|
||||||
#include <Kernel/SharedMemory.h>
|
#include <Kernel/SharedMemory.h>
|
||||||
|
|
Loading…
Reference in a new issue