diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2010-06-02 12:58:00 -0500 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2010-06-02 12:58:00 -0500 |
commit | 3951afd2fa6140f85a94c9636ac2d9e9d3a1c764 (patch) | |
tree | c87b78c2a3e450fb5cbc4529e15446fb97b2571f /src/base/loader | |
parent | ebb273bb7b8a871c1c5c07e00593e0194985aa46 (diff) | |
download | gem5-3951afd2fa6140f85a94c9636ac2d9e9d3a1c764.tar.xz |
ARM: Detect thumb mode elf images.
Diffstat (limited to 'src/base/loader')
-rw-r--r-- | src/base/loader/elf_object.cc | 7 | ||||
-rw-r--r-- | src/base/loader/object_file.hh | 1 |
2 files changed, 7 insertions, 1 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 }; |