Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/18586

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

mips: Add an object file loader for linux.

Change-Id: Icae6430a210076117cf2ceadce52d6efbe58a5f3
---
M src/arch/mips/linux/process.cc
1 file changed, 31 insertions(+), 0 deletions(-)



diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc
index b1c09a5..51c1101 100644
--- a/src/arch/mips/linux/process.cc
+++ b/src/arch/mips/linux/process.cc
@@ -34,6 +34,7 @@

 #include "arch/mips/isa_traits.hh"
 #include "arch/mips/linux/linux.hh"
+#include "base/loader/loader.hh"
 #include "base/trace.hh"
 #include "cpu/thread_context.hh"
 #include "debug/SyscallVerbose.hh"
@@ -47,6 +48,36 @@
 using namespace std;
 using namespace MipsISA;

+namespace
+{
+
+class MipsLinuxObjectFileLoader : public ObjectFileLoader
+{
+  public:
+    Process *
+    load(ProcessParams *params, ObjectFile *obj_file) override
+    {
+        if (obj_file->getArch() != ObjectFile::Mips)
+            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 MipsLinuxProcess(params, obj_file);
+    }
+};
+
+MipsLinuxObjectFileLoader 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/+/18586
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: Icae6430a210076117cf2ceadce52d6efbe58a5f3
Gerrit-Change-Number: 18586
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to