summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2019-05-02 22:53:23 -0700
committerGabe Black <gabeblack@google.com>2019-05-20 06:08:24 +0000
commit5ab2ffd3816887b92ecb369e8e42cc03ea43d7be (patch)
tree1d5cb147f41403164e80d030ddfadb27f963e888 /src
parent1e0bb9bcde3eeb5e02dadbef4000498727277cfe (diff)
downloadgem5-5ab2ffd3816887b92ecb369e8e42cc03ea43d7be.tar.xz
power: Add an object file loader for linux.
Change-Id: I64ce81e98a6dc96754554d0fdcd7d16b8a2752d4 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18587 Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Sandipan Das <sandipan@linux.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/arch/power/linux/process.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc
index 664b93bde..ea0fc9021 100644
--- a/src/arch/power/linux/process.cc
+++ b/src/arch/power/linux/process.cc
@@ -36,6 +36,7 @@
#include "arch/power/isa_traits.hh"
#include "arch/power/linux/linux.hh"
+#include "base/loader/object_file.hh"
#include "base/trace.hh"
#include "cpu/thread_context.hh"
#include "kern/linux/linux.hh"
@@ -47,6 +48,36 @@
using namespace std;
using namespace PowerISA;
+namespace
+{
+
+class PowerLinuxObjectFileLoader : public ObjectFile::Loader
+{
+ public:
+ Process *
+ load(ProcessParams *params, ObjectFile *obj_file) override
+ {
+ if (obj_file->getArch() != ObjectFile::Power)
+ 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 PowerLinuxProcess(params, obj_file);
+ }
+};
+
+PowerLinuxObjectFileLoader loader;
+
+} // anonymous namespace
+
/// Target uname() handler.
static SyscallReturn
unameFunc(SyscallDesc *desc, int callnum, Process *process,