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>
This commit is contained in:
Gabe Black
2019-05-02 22:52:23 -07:00
parent c1b748d691
commit 9601ba915d

View File

@@ -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,