From: Sandipan Das Date: Mon, 4 Jun 2018 16:21:23 +0000 (+0530) Subject: arch-power: Make ELF interpreter read 64-bit LSB executables X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fe7ace1e919fb160107701edc870548b9da155bc;p=gem5.git 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 --- diff --git a/src/arch/power/isa_traits.hh b/src/arch/power/isa_traits.hh index 9afe6803a..99f76ffad 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 60c79f803..8e1e065a5 100644 --- a/src/base/loader/elf_object.cc +++ b/src/base/loader/elf_object.cc @@ -115,16 +115,17 @@ ElfObject::tryFile(const std::string &fname, size_t len, uint8_t *data, arch = Riscv; } 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