summaryrefslogtreecommitdiff
path: root/ELFLoader/ExecSpace.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-18 15:03:10 +0200
committerAndreas Kling <awesomekling@gmail.com>2018-10-18 15:03:10 +0200
commitc149d2a8f0d998c716ea86bbec55f2e172e46e49 (patch)
treee22f565cae5313f9c80a71a7246801416b10e6f9 /ELFLoader/ExecSpace.cpp
parent3649638259763c362300f494f9663e24dd492b62 (diff)
downloadserenity-c149d2a8f0d998c716ea86bbec55f2e172e46e49.zip
Build ELFLoader into Kernel.
Diffstat (limited to 'ELFLoader/ExecSpace.cpp')
-rw-r--r--ELFLoader/ExecSpace.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/ELFLoader/ExecSpace.cpp b/ELFLoader/ExecSpace.cpp
index 8239d0c1a5..ca625b4311 100644
--- a/ELFLoader/ExecSpace.cpp
+++ b/ELFLoader/ExecSpace.cpp
@@ -1,7 +1,7 @@
#include "ExecSpace.h"
#include "ELFLoader.h"
#include <AK/TemporaryFile.h>
-#include <unistd.h>
+#include <AK/Types.h>
ExecSpace::ExecSpace()
{
@@ -19,7 +19,7 @@ void ExecSpace::initializeBuiltins()
bool ExecSpace::loadELF(MappedFile&& file)
{
- ELFLoader loader(*this, std::move(file));
+ ELFLoader loader(*this, move(file));
if (!loader.load())
return false;
printf("[ExecSpace] ELF loaded, symbol map now:\n");
@@ -34,6 +34,8 @@ bool ExecSpace::loadELF(MappedFile&& file)
static void disassemble(const char* data, size_t length)
{
+#ifdef SERENITY_KERNEL
+#else
if (!length)
return;
@@ -52,6 +54,7 @@ static void disassemble(const char* data, size_t length)
char cmdbuf[128];
sprintf(cmdbuf, "nasm -f bin -o /dev/stdout %s | ndisasm -b32 -", temp.fileName().characters());
system(cmdbuf);
+#endif
}
char* ExecSpace::symbolPtr(const char* name)
@@ -65,16 +68,15 @@ char* ExecSpace::symbolPtr(const char* name)
return nullptr;
}
-
char* ExecSpace::allocateArea(String&& name, unsigned size)
{
- char* ptr = static_cast<char*>(malloc(size));
+ char* ptr = static_cast<char*>(kmalloc(size));
ASSERT(ptr);
- m_areas.append(make<Area>(std::move(name), ptr, size));
+ m_areas.append(make<Area>(move(name), ptr, size));
return ptr;
}
void ExecSpace::addSymbol(String&& name, char* ptr, unsigned size)
{
- m_symbols.set(std::move(name), { ptr, size });
+ m_symbols.set(move(name), { ptr, size });
}