Gabe Black has submitted this change and it was merged. (
https://gem5-review.googlesource.com/c/public/gem5/+/18628 )
Change subject: riscv: Add an object file loader for linux.
......................................................................
riscv: Add an object file loader for linux.
Change-Id: I3accca91cc4e02fa8e3a1169590cbe6696cf05e2
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/18628
Tested-by: kokoro <[email protected]>
Reviewed-by: Alec Roelke <[email protected]>
Maintainer: Alec Roelke <[email protected]>
---
M src/arch/riscv/linux/process.cc
1 file changed, 35 insertions(+), 0 deletions(-)
Approvals:
Alec Roelke: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/riscv/linux/process.cc
b/src/arch/riscv/linux/process.cc
index 7239920..b2d0305 100644
--- a/src/arch/riscv/linux/process.cc
+++ b/src/arch/riscv/linux/process.cc
@@ -38,6 +38,7 @@
#include "arch/riscv/isa_traits.hh"
#include "arch/riscv/linux/linux.hh"
+#include "base/loader/object_file.hh"
#include "base/trace.hh"
#include "cpu/thread_context.hh"
#include "debug/SyscallVerbose.hh"
@@ -51,6 +52,40 @@
using namespace std;
using namespace RiscvISA;
+namespace
+{
+
+class RiscvLinuxObjectFileLoader : 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::Riscv64 && arch != ObjectFile::Riscv32)
+ return nullptr;
+
+ if (opsys == ObjectFile::UnknownOpSys) {
+ warn("Unknown operating system; assuming Linux.");
+ opsys = ObjectFile::Linux;
+ }
+
+ if (opsys != ObjectFile::Linux)
+ return nullptr;
+
+ if (arch == ObjectFile::Riscv64)
+ return new RiscvLinuxProcess64(params, obj_file);
+ else
+ return new RiscvLinuxProcess32(params, obj_file);
+ }
+};
+
+RiscvLinuxObjectFileLoader loader;
+
+} // anonymous namespace
+
/// Target uname() handler.
static SyscallReturn
unameFunc64(SyscallDesc *desc, int callnum, Process *process,
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/18628
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: I3accca91cc4e02fa8e3a1169590cbe6696cf05e2
Gerrit-Change-Number: 18628
Gerrit-PatchSet: 4
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Alec Roelke <[email protected]>
Gerrit-Reviewer: Alec Roelke <[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: Tuan Ta <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev