ARM: Detect thumb mode elf images.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -53,6 +53,7 @@ class ObjectFile
|
||||
X86_64,
|
||||
I386,
|
||||
Arm,
|
||||
Thumb,
|
||||
Power
|
||||
};
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user