Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/18587 )

Change subject: power: Add an object file loader for linux.
......................................................................

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 <gabebl...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Sandipan Das <sandi...@linux.ibm.com>
---
M src/arch/power/linux/process.cc
1 file changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Sandipan Das: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc
index 664b93b..ea0fc90 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,

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18587
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I64ce81e98a6dc96754554d0fdcd7d16b8a2752d4
Gerrit-Change-Number: 18587
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Brandon Potter <brandon.pot...@amd.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Sandipan Das <sandi...@linux.ibm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to