summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/loader/elf_object.cc7
-rw-r--r--src/base/loader/object_file.hh1
-rw-r--r--src/sim/process.cc8
3 files changed, 13 insertions, 3 deletions
diff --git a/src/base/loader/elf_object.cc b/src/base/loader/elf_object.cc
index 60f0f99b4..6096cb2e3 100644
--- a/src/base/loader/elf_object.cc
+++ b/src/base/loader/elf_object.cc
@@ -34,6 +34,7 @@
#include "gelf.h"
+#include "base/bitfield.hh"
#include "base/loader/elf_object.hh"
#include "base/loader/symtab.hh"
#include "base/misc.hh"
@@ -96,7 +97,11 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
} else if (ehdr.e_ident[EI_CLASS] == ELFCLASS64) {
arch = ObjectFile::Alpha;
} else if (ehdr.e_machine == EM_ARM) {
- arch = ObjectFile::Arm;
+ if (bits(ehdr.e_entry, 0)) {
+ arch = ObjectFile::Thumb;
+ } else {
+ arch = ObjectFile::Arm;
+ }
} else if (ehdr.e_machine == EM_PPC &&
ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
if (ehdr.e_ident[EI_DATA] == ELFDATA2MSB) {
diff --git a/src/base/loader/object_file.hh b/src/base/loader/object_file.hh
index b08f1c633..bffab0cc5 100644
--- a/src/base/loader/object_file.hh
+++ b/src/base/loader/object_file.hh
@@ -53,6 +53,7 @@ class ObjectFile
X86_64,
I386,
Arm,
+ Thumb,
Power
};
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 957c3cc3e..18f33abdc 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -755,14 +755,18 @@ LiveProcess::create(LiveProcessParams * params)
fatal("Unknown/unsupported operating system.");
}
#elif THE_ISA == ARM_ISA
- if (objFile->getArch() != ObjectFile::Arm)
+ if (objFile->getArch() != ObjectFile::Arm &&
+ objFile->getArch() != ObjectFile::Thumb)
fatal("Object file architecture does not match compiled ISA (ARM).");
switch (objFile->getOpSys()) {
case ObjectFile::UnknownOpSys:
warn("Unknown operating system; assuming Linux.");
// fall through
case ObjectFile::Linux:
- process = new ArmLinuxProcess(params, objFile);
+ if (objFile->getArch() == ObjectFile::Thumb)
+ panic("Thumb processes not yet supported.\n");
+ else
+ process = new ArmLinuxProcess(params, objFile);
break;
case ObjectFile::LinuxArmOABI:
fatal("M5 does not support ARM OABI binaries. Please recompile with an"