From: Gabe Black Date: Fri, 3 May 2019 05:52:23 +0000 (-0700) Subject: alpha: Add an object file loader for linux. X-Git-Tag: v19.0.0.0~836 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9601ba915dc40ed170f4c85446afbdc857058bb9;p=gem5.git 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 Maintainer: Gabe Black Tested-by: kokoro --- 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,