Sandipan Das has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/16605

Change subject: arch-power: Make ELF interpreter read 64-bit LSB executables
......................................................................

arch-power: Make ELF interpreter read 64-bit LSB executables

This makes the ELF interpreter read 64-bit little endian (LSB)
PowerPC executables only. This drops support for the 32-bit big
endian (MSB) executables as the goal here is to enable a modern
64-bit execution environment for the Power ISA.

Change-Id: I0569f7e1d1e58ce874ec2d13291e7a758d56399f
Signed-off-by: Sandipan Das <[email protected]>
---
M src/arch/power/isa_traits.hh
M src/base/loader/elf_object.cc
2 files changed, 9 insertions(+), 8 deletions(-)



diff --git a/src/arch/power/isa_traits.hh b/src/arch/power/isa_traits.hh
index 9afe680..99f76ff 100644
--- a/src/arch/power/isa_traits.hh
+++ b/src/arch/power/isa_traits.hh
@@ -39,12 +39,12 @@
 #include "base/types.hh"
 #include "cpu/static_inst_fwd.hh"

-namespace BigEndianGuest {}
+namespace LittleEndianGuest {}

 namespace PowerISA
 {

-using namespace BigEndianGuest;
+using namespace LittleEndianGuest;

 StaticInstPtr decodeInst(ExtMachInst);

diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index 761fd79..e13497d 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -115,16 +115,17 @@
         arch = (ehdr.e_ident[EI_CLASS] == ELFCLASS64) ? Riscv64 : Riscv32;
     } else if (ehdr.e_machine == EM_PPC &&
                ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
+        fatal("The binary you're trying to load is compiled for 32-bit "
+              "Power.\ngem5 only supports 64-bit Power. Please "
+              "recompile your binary.\n");
+    } else if (ehdr.e_machine == EM_PPC64 &&
+               ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
         arch = Power;
-        if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB) {
+        if (ehdr.e_ident[EI_DATA] != ELFDATA2LSB) {
             fatal("The binary you're trying to load is compiled for "
-                  "little endian Power.\ngem5 only supports big "
+                  "big endian Power.\ngem5 only supports little "
                   "endian Power. Please recompile your binary.\n");
         }
-    } else if (ehdr.e_machine == EM_PPC64) {
-        fatal("The binary you're trying to load is compiled for 64-bit "
-              "Power. M5\n only supports 32-bit Power. Please "
-              "recompile your binary.\n");
     } else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
         // Since we don't know how to check for alpha right now, we'll
         // just assume if it wasn't something else and it's 64 bit, that's

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/16605
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: I0569f7e1d1e58ce874ec2d13291e7a758d56399f
Gerrit-Change-Number: 16605
Gerrit-PatchSet: 1
Gerrit-Owner: Sandipan Das <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to