summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/loader/elf_object.cc13
-rw-r--r--src/base/loader/object_file.hh3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index 15ad88f76..60f0f99b4 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -97,6 +97,19 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
arch = ObjectFile::Alpha;
} else if (ehdr.e_machine == EM_ARM) {
arch = ObjectFile::Arm;
+ } else if (ehdr.e_machine == EM_PPC &&
+ ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
+ if (ehdr.e_ident[EI_DATA] == ELFDATA2MSB) {
+ arch = ObjectFile::Power;
+ } else {
+ fatal("The binary you're trying to load is compiled for "
+ "little endian Power.\nM5 only supports big "
+ "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 {
warn("Unknown architecture: %d\n", ehdr.e_machine);
arch = ObjectFile::UnknownArch;
diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh
index e511451b7..b08f1c633 100644
--- a/src/base/loader/object_file.hh
+++ b/src/base/loader/object_file.hh
@@ -52,7 +52,8 @@ class ObjectFile
Mips,
X86_64,
I386,
- Arm
+ Arm,
+ Power
};
enum OpSys {