summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2003-12-01 19:34:51 -0800
committerSteve Reinhardt <stever@eecs.umich.edu>2003-12-01 19:34:51 -0800
commit745f0044cd65d476b3b190377989eb0af3738df5 (patch)
treebc29a2944891cdfa20edeebe80e3a4ea08c0e3a7 /base
parent5b24b5a5c5d336eb1594e65826caf2a28da3ede1 (diff)
parent7976794aadd7f308010f88aa3a8a6e3469e37ba7 (diff)
downloadgem5-745f0044cd65d476b3b190377989eb0af3738df5.tar.xz
Merge zizzer:/bk/m5 into isabel.reinhardt.house:/z/stever/bk/m5
--HG-- extra : convert_revision : d66ebc598fdcfc9477ea5a1e455b21d7b9e56936
Diffstat (limited to 'base')
-rw-r--r--base/loader/aout_object.cc9
-rw-r--r--base/loader/aout_object.hh3
-rw-r--r--base/loader/ecoff_object.cc8
-rw-r--r--base/loader/ecoff_object.hh3
-rw-r--r--base/loader/elf_object.cc10
-rw-r--r--base/loader/elf_object.hh3
-rw-r--r--base/loader/object_file.cc6
-rw-r--r--base/loader/object_file.hh22
8 files changed, 48 insertions, 16 deletions
diff --git a/base/loader/aout_object.cc b/base/loader/aout_object.cc
index 0270e02a3..42a376ed1 100644
--- a/base/loader/aout_object.cc
+++ b/base/loader/aout_object.cc
@@ -43,7 +43,9 @@ ObjectFile *
AoutObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
{
if (!N_BADMAG(*(aout_exechdr *)data)) {
- return new AoutObject(fname, fd, len, data);
+ // right now this is only used for Alpha PAL code
+ return new AoutObject(fname, fd, len, data,
+ ObjectFile::Alpha, ObjectFile::UnknownOpSys);
}
else {
return NULL;
@@ -52,8 +54,9 @@ AoutObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
AoutObject::AoutObject(const string &_filename, int _fd,
- size_t _len, uint8_t *_data)
- : ObjectFile(_filename, _fd, _len, _data)
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys)
+ : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys)
{
execHdr = (aout_exechdr *)fileData;
diff --git a/base/loader/aout_object.hh b/base/loader/aout_object.hh
index 77c59aef6..9fb8cb3e8 100644
--- a/base/loader/aout_object.hh
+++ b/base/loader/aout_object.hh
@@ -40,7 +40,8 @@ class AoutObject : public ObjectFile
aout_exechdr *execHdr;
AoutObject(const std::string &_filename, int _fd,
- size_t _len, uint8_t *_data);
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys);
public:
virtual ~AoutObject() {}
diff --git a/base/loader/ecoff_object.cc b/base/loader/ecoff_object.cc
index 5e726a1c5..bab75944d 100644
--- a/base/loader/ecoff_object.cc
+++ b/base/loader/ecoff_object.cc
@@ -46,7 +46,8 @@ EcoffObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
{
if (((ecoff_filehdr *)data)->f_magic == ECOFF_MAGIC_ALPHA) {
// it's Alpha ECOFF
- return new EcoffObject(fname, fd, len, data);
+ return new EcoffObject(fname, fd, len, data,
+ ObjectFile::Alpha, ObjectFile::Tru64);
}
else {
return NULL;
@@ -55,8 +56,9 @@ EcoffObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
EcoffObject::EcoffObject(const string &_filename, int _fd,
- size_t _len, uint8_t *_data)
- : ObjectFile(_filename, _fd, _len, _data)
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys)
+ : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys)
{
execHdr = (ecoff_exechdr *)fileData;
fileHdr = &(execHdr->f);
diff --git a/base/loader/ecoff_object.hh b/base/loader/ecoff_object.hh
index 94b11c720..05d026d00 100644
--- a/base/loader/ecoff_object.hh
+++ b/base/loader/ecoff_object.hh
@@ -44,7 +44,8 @@ class EcoffObject : public ObjectFile
ecoff_aouthdr *aoutHdr;
EcoffObject(const std::string &_filename, int _fd,
- size_t _len, uint8_t *_data);
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys);
public:
virtual ~EcoffObject() {}
diff --git a/base/loader/elf_object.cc b/base/loader/elf_object.cc
index 605895c9c..30dec4c91 100644
--- a/base/loader/elf_object.cc
+++ b/base/loader/elf_object.cc
@@ -43,8 +43,9 @@ ObjectFile *
ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
{
if (memcmp(((Elf64_Ehdr *)data)->e_ident, ELFMAG, SELFMAG) == 0) {
- // for now we'll assume it's a 64-bit Alpha binary
- return new ElfObject(fname, fd, len, data);
+ // for now we'll assume it's a 64-bit Alpha Linux binary
+ return new ElfObject(fname, fd, len, data,
+ ObjectFile::Alpha, ObjectFile::Linux);
}
else {
return NULL;
@@ -53,8 +54,9 @@ ElfObject::tryFile(const string &fname, int fd, size_t len, uint8_t *data)
ElfObject::ElfObject(const string &_filename, int _fd,
- size_t _len, uint8_t *_data)
- : ObjectFile(_filename, _fd, _len, _data)
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys)
+ : ObjectFile(_filename, _fd, _len, _data, _arch, _opSys)
{
ehdr = (Elf64_Ehdr *)fileData;
diff --git a/base/loader/elf_object.hh b/base/loader/elf_object.hh
index 28f6bb243..10d97d089 100644
--- a/base/loader/elf_object.hh
+++ b/base/loader/elf_object.hh
@@ -45,7 +45,8 @@ class ElfObject : public ObjectFile
int dataPhdrIdx;
ElfObject(const std::string &_filename, int _fd,
- size_t _len, uint8_t *_data);
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys);
public:
virtual ~ElfObject() {}
diff --git a/base/loader/object_file.cc b/base/loader/object_file.cc
index 5a13d180c..25e9b2d19 100644
--- a/base/loader/object_file.cc
+++ b/base/loader/object_file.cc
@@ -46,8 +46,10 @@
using namespace std;
ObjectFile::ObjectFile(const string &_filename, int _fd,
- size_t _len, uint8_t *_data)
- : filename(_filename), descriptor(_fd), fileData(_data), len(_len)
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys)
+ : filename(_filename), descriptor(_fd), fileData(_data), len(_len),
+ arch(_arch), opSys(_opSys)
{
}
diff --git a/base/loader/object_file.hh b/base/loader/object_file.hh
index 5950ea326..a29bdc153 100644
--- a/base/loader/object_file.hh
+++ b/base/loader/object_file.hh
@@ -36,14 +36,31 @@ class SymbolTable;
class ObjectFile
{
+ public:
+
+ enum Arch {
+ UnknownArch,
+ Alpha
+ };
+
+ enum OpSys {
+ UnknownOpSys,
+ Tru64,
+ Linux
+ };
+
protected:
const std::string filename;
int descriptor;
uint8_t *fileData;
size_t len;
+ Arch arch;
+ OpSys opSys;
+
ObjectFile(const std::string &_filename, int _fd,
- size_t _len, uint8_t *_data);
+ size_t _len, uint8_t *_data,
+ Arch _arch, OpSys _opSys);
public:
virtual ~ObjectFile();
@@ -55,6 +72,9 @@ class ObjectFile
virtual bool loadGlobalSymbols(SymbolTable *symtab) = 0;
virtual bool loadLocalSymbols(SymbolTable *symtab) = 0;
+ Arch getArch() const { return arch; }
+ OpSys getOpSys() const { return opSys; }
+
protected:
struct Section {