summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-05-15 17:37:03 -0400
committerAli Saidi <saidi@eecs.umich.edu>2006-05-15 17:37:03 -0400
commita6266a99e26a23d3a2f52e05f3742984629c3786 (patch)
tree5e47a70f51b2d5489d715d6a6c2ac61521c79074 /base
parentc7b26d015a9731395ed7c9bbbed31fc83b26c5b6 (diff)
downloadgem5-a6266a99e26a23d3a2f52e05f3742984629c3786.tar.xz
Add support for sparc/solaris syscall emulation. Not tested yet because I can't get a static sparc 64 binary
arch/sparc/SConscript: arch/sparc/process.cc: base/loader/elf_object.cc: Add support for sparc/solaris syscall emulation. --HG-- extra : convert_revision : e22df8476e5c6ae14db1cab1d94d01c0578ea06c
Diffstat (limited to 'base')
-rw-r--r--base/loader/elf_object.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc
index a104719af..3f6131088 100644
--- a/base/loader/elf_object.cc
+++ b/base/loader/elf_object.cc
@@ -82,7 +82,8 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
//what it must be.
if (ehdr.e_machine == EM_SPARC64 ||
ehdr.e_machine == EM_SPARC ||
- ehdr.e_machine == EM_SPARCV9) {
+ ehdr.e_machine == EM_SPARCV9 ||
+ ehdr.e_machine == EM_SPARC32PLUS) {
arch = ObjectFile::SPARC;
} else if (ehdr.e_machine == EM_MIPS
&& ehdr.e_ident[EI_CLASS] == ELFCLASS32) {
@@ -90,6 +91,7 @@ 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 {
+ warn("Unknown architecture: %d\n", ehdr.e_machine);
arch = ObjectFile::UnknownArch;
}
@@ -112,8 +114,7 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
//take a look at the .note.ABI section
//It can let us know what's what.
- if (opSys == ObjectFile::UnknownOpSys)
- {
+ if (opSys == ObjectFile::UnknownOpSys) {
Elf_Scn *section;
GElf_Shdr shdr;
Elf_Data *data;
@@ -124,7 +125,7 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
section = elf_getscn(elf, secIdx);
// While there are no more sections
- while (section != NULL) {
+ while (section != NULL && opSys == ObjectFile::UnknownOpSys) {
gelf_getshdr(section, &shdr);
if (shdr.sh_type == SHT_NOTE && !strcmp(".note.ABI-tag",
elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name))) {
@@ -147,6 +148,11 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
break;
}
} // if section found
+ if (!strcmp(".SUNW_version", elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name)))
+ opSys = ObjectFile::Solaris;
+ if (!strcmp(".stab.index", elf_strptr(elf, ehdr.e_shstrndx, shdr.sh_name)))
+ opSys = ObjectFile::Solaris;
+
section = elf_getscn(elf, ++secIdx);
} // while sections
}