Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/18629 )
Change subject: sparc: Add an object file loader for linux and solaris.
......................................................................
sparc: Add an object file loader for linux and solaris.
Change-Id: I76bcbc06714f7d538f03a8311994a868de3640f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18629
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/sparc/linux/process.cc
M src/arch/sparc/solaris/process.cc
2 files changed, 62 insertions(+), 0 deletions(-)
Approvals:
Gabe Black: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/sparc/linux/process.cc
b/src/arch/sparc/linux/process.cc
index d12f130..2fd9838 100644
--- a/src/arch/sparc/linux/process.cc
+++ b/src/arch/sparc/linux/process.cc
@@ -34,6 +34,7 @@
#include "arch/sparc/isa_traits.hh"
#include "arch/sparc/registers.hh"
+#include "base/loader/object_file.hh"
#include "base/trace.hh"
#include "cpu/thread_context.hh"
#include "kern/linux/linux.hh"
@@ -44,6 +45,40 @@
using namespace std;
using namespace SparcISA;
+namespace
+{
+
+class SparcLinuxObjectFileLoader : public ObjectFile::Loader
+{
+ public:
+ Process *
+ load(ProcessParams *params, ObjectFile *obj_file) override
+ {
+ auto arch = obj_file->getArch();
+ auto opsys = obj_file->getOpSys();
+
+ if (arch != ObjectFile::SPARC64 && arch != ObjectFile::SPARC32)
+ return nullptr;
+
+ if (opsys == ObjectFile::UnknownOpSys) {
+ warn("Unknown operating system; assuming Linux.");
+ opsys = ObjectFile::Linux;
+ }
+
+ if (opsys != ObjectFile::Linux)
+ return nullptr;
+
+ if (arch == ObjectFile::SPARC64)
+ return new Sparc64LinuxProcess(params, obj_file);
+ else
+ return new Sparc32LinuxProcess(params, obj_file);
+ }
+};
+
+SparcLinuxObjectFileLoader loader;
+
+} // anonymous namespace
+
SyscallDesc*
SparcLinuxProcess::getDesc(int callnum)
{
diff --git a/src/arch/sparc/solaris/process.cc
b/src/arch/sparc/solaris/process.cc
index bcdd088..70381c5 100644
--- a/src/arch/sparc/solaris/process.cc
+++ b/src/arch/sparc/solaris/process.cc
@@ -32,6 +32,7 @@
#include "arch/sparc/isa_traits.hh"
#include "arch/sparc/registers.hh"
+#include "base/loader/object_file.hh"
#include "base/trace.hh"
#include "cpu/thread_context.hh"
#include "kern/solaris/solaris.hh"
@@ -42,6 +43,32 @@
using namespace std;
using namespace SparcISA;
+namespace
+{
+
+class SparcSolarisObjectFileLoader : public ObjectFile::Loader
+{
+ public:
+ Process *
+ load(ProcessParams *params, ObjectFile *obj_file) override
+ {
+ auto arch = obj_file->getArch();
+ auto opsys = obj_file->getOpSys();
+
+ if (arch != ObjectFile::SPARC64 && arch != ObjectFile::SPARC32)
+ return nullptr;
+
+ if (opsys != ObjectFile::Solaris)
+ return nullptr;
+
+ return new SparcSolarisProcess(params, obj_file);
+ }
+};
+
+SparcSolarisObjectFileLoader loader;
+
+} // anonymous namespace
+
/// Target uname() handler.
static SyscallReturn
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18629
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: I76bcbc06714f7d538f03a8311994a868de3640f1
Gerrit-Change-Number: 18629
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Brandon Potter <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev