diff options
author | Gabe Black <gabeblack@google.com> | 2019-05-02 22:52:23 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-05-18 18:28:12 +0000 |
commit | 9601ba915dc40ed170f4c85446afbdc857058bb9 (patch) | |
tree | 9fde0b2f1bc423ede7548907ff538f2ad4ca57ab /src/arch/alpha/linux/process.cc | |
parent | c1b748d691fe407c7cd43330658fba83e3435247 (diff) | |
download | gem5-9601ba915dc40ed170f4c85446afbdc857058bb9.tar.xz |
alpha: Add an object file loader for linux.
Change-Id: I91c4019567bdf74b2517fda597121a6ad107cb86
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18584
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/arch/alpha/linux/process.cc')
-rw-r--r-- | src/arch/alpha/linux/process.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index c1162bad0..cbf45f16c 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -33,6 +33,7 @@ #include "arch/alpha/isa_traits.hh" #include "arch/alpha/linux/linux.hh" +#include "base/loader/object_file.hh" #include "base/trace.hh" #include "cpu/thread_context.hh" #include "debug/SyscallVerbose.hh" @@ -44,6 +45,36 @@ using namespace std; using namespace AlphaISA; +namespace +{ + +class AlphaLinuxObjectFileLoader : public ObjectFile::Loader +{ + public: + Process * + load(ProcessParams *params, ObjectFile *obj_file) override + { + if (obj_file->getArch() != ObjectFile::Alpha) + return nullptr; + + auto opsys = obj_file->getOpSys(); + + if (opsys == ObjectFile::UnknownOpSys) { + warn("Unknown operating system; assuming Linux."); + opsys = ObjectFile::Linux; + } + + if (opsys != ObjectFile::Linux) + return nullptr; + + return new AlphaLinuxProcess(params, obj_file); + } +}; + +AlphaLinuxObjectFileLoader loader; + +} // anonymous namespace + /// Target uname() handler. static SyscallReturn unameFunc(SyscallDesc *desc, int callnum, Process *process, |