From 9601ba915dc40ed170f4c85446afbdc857058bb9 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 2 May 2019 22:52:23 -0700 Subject: [PATCH] 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 --- src/arch/alpha/linux/process.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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, -- 2.30.2