OpenASIP  2.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TPEF::AOutReader Class Reference

#include <AOutReader.hh>

Inheritance diagram for TPEF::AOutReader:
Inheritance graph
Collaboration diagram for TPEF::AOutReader:
Collaboration graph

Classes

class  Header
 

Public Types

enum  SymbolType {
  N_UNDF = 0x0, N_ABS = 0x2, N_TEXT = 0x4, N_DATA = 0x6,
  N_BSS = 0x8, N_COMM = 0x12, N_FN = 0x1e, N_EXT = 0x1,
  N_TYPE = 0x1e, N_TJ = 0x76, N_JTE = 0x96, N_MEM = 0xb6,
  N_FC = 0xd6, N_STAB = 0xe0, N_GSYM = 0x20, N_FNAME = 0x22,
  N_FUN = 0x24, N_STSYM = 0x26, N_LCSYM = 0x28, N_MAIN = 0x2a,
  N_RSYM = 0x40, N_SLINE = 0x44, N_SSYM = 0x60, N_SO = 0x64,
  N_LSYM = 0x80, N_BINCL = 0x82, N_SOL = 0x84, N_PSYM = 0xa0,
  N_EINCL = 0xa2, N_LBRAC = 0xc0, N_EXCL = 0xc2, N_RBRAC = 0xe0,
  N_BCOMM = 0xe2, N_ECOMM = 0xe4, N_ECOML = 0xe8, N_LENG = 0xfe,
  N_PC = 0x30, N_M2C = 0x42, N_SCOPE = 0xc4, N_BROWS = 0x48,
  N_PRTAB = 0xd2, N_ANN = 0xa4
}
 
enum  AOutSectionID {
  ST_UNDEF = 0x00, ST_TEXT = N_TEXT, ST_DATA = N_DATA, ST_UDATA = N_BSS,
  ST_SYMBOL = 0x10, ST_STRING = 0x12
}
 
- Public Types inherited from TPEF::BinaryReader
typedef unsigned long Length
 

Public Member Functions

SectionOffset sectionOffsetOfAddress (AddressImage address) const
 
AddressImage addressOfElement (SectionElement *elem) const
 
ASpaceElementaSpaceOfElement (SectionElement *elem) const
 
ResourceSectionresourceTable () const
 
NullSectionnullSection () const
 
DebugSectiondebugSection () const
 
StringSectionstringSection () const
 
CodeSectiontextSection () const
 
- Public Member Functions inherited from TPEF::BinaryReader
virtual ~BinaryReader ()
 

Static Public Member Functions

static BinaryReaderinstance ()
 
static const Headerheader ()
 
- Static Public Member Functions inherited from TPEF::BinaryReader
static BinaryreadBinary (BinaryStream &stream)
 

Static Public Attributes

static const Word INT_REGISTERS = 1024
 Number of integer registers. More...
 
static const Word FP_REGISTERS = 1024
 Number of floating-point registers. More...
 
static const Word BOOL_REGISTERS = 1
 Number of Boolean registers. More...
 
static const Word FIRST_INT_REGISTER = 0
 Index of the first integer register in a.out. More...
 
static const Word FIRST_FP_REGISTER = FIRST_INT_REGISTER + INT_REGISTERS
 Index of the first floating-point register. More...
 
static const Word FIRST_BOOL_REGISTER = FIRST_FP_REGISTER + FP_REGISTERS
 Index of the first Boolean register. More...
 
static const Word FIRST_FU_REGISTER = FIRST_BOOL_REGISTER + BOOL_REGISTERS
 Index of the first function unit register. More...
 
static const Byte AOUT_INSTRUCTION_SIZE = 8
 Size of one instruction in a.out file. More...
 
static const Byte AOUT_BITS_PER_MAU = 8
 Minimum addressable word of address space. More...
 
static const Byte AOUT_WORD_ALIGN = 4
 Aligment of address space. More...
 
static const Byte AOUT_WORD_SIZE = 4
 Word size of address space. More...
 
static const char * AOUT_CODE_ASPACE_NAME = "universal_instructions"
 Name of universal machines code address space. More...
 
static const char * AOUT_DATA_ASPACE_NAME = "universal_data"
 Name of universal machines data address space. More...
 

Protected Member Functions

 AOutReader ()
 
virtual ~AOutReader ()
 
virtual BinaryreadData (BinaryStream &stream) const
 
virtual bool isMyStreamType (BinaryStream &stream) const
 
- Protected Member Functions inherited from TPEF::BinaryReader
 BinaryReader ()
 

Private Member Functions

void readHeader (BinaryStream &stream) const
 
void readSection (BinaryStream &stream, FileOffset startPosition, Section *section, Length length) const
 
void addOrDeleteSection (Section *section, Binary *binary) const
 
 AOutReader (const AOutReader &)
 Copying not allowed. More...
 
AOutReaderoperator= (const AOutReader &)
 Assignment not allowed. More...
 

Private Attributes

ASpaceElementundefASpace_
 Undefined address space. More...
 
ASpaceElementcodeASpace_
 Address space of text section. More...
 
ASpaceElementdataASpace_
 Address space of data sections. More...
 

Static Private Attributes

static ResourceSectionresourceTable_ = NULL
 
static NullSectionnullSection_ = NULL
 
static DebugSectiondebugSection_ = NULL
 
static StringSectionstringSection_ = NULL
 
static CodeSectiontextSection_ = NULL
 
static const HalfWord OMAGIC = 0x0107
 Move a.out format identifier. More...
 
static const Byte FILE_HEADER_SIZE = 8 * sizeof(Word)
 Size of file header. More...
 
static Header header_
 Header of a.out file. More...
 
static AOutReaderproto_ = NULL
 Prototype instance of AOutReader registered into BinaryReader. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from TPEF::BinaryReader
static void registerBinaryReader (BinaryReader *reader)
 

Detailed Description

Reads binary file that is in TTA a.out format.

Definition at line 54 of file AOutReader.hh.

Member Enumeration Documentation

◆ AOutSectionID

Names for a.out sections.

Sections are expected in this order in a.out file. Since there is only one section of each type, these names can be used as section identifiers.

Enumerator
ST_UNDEF 

Undefined section.

ST_TEXT 

Text section.

ST_DATA 

Data section.

ST_UDATA 

Uninitialized data section.

ST_SYMBOL 

Symbol table.

ST_STRING 

String table.

Definition at line 114 of file AOutReader.hh.

114  {
115  ST_UNDEF = 0x00, ///< Undefined section.
116  ST_TEXT = N_TEXT, ///< Text section.
117  ST_DATA = N_DATA, ///< Data section.
118  ST_UDATA = N_BSS, ///< Uninitialized data section.
119  ST_SYMBOL = 0x10, ///< Symbol table.
120  ST_STRING = 0x12 ///< String table.
121  };

◆ SymbolType

TODO: get these from tce-frontend a.out symbols. (from MOVE/sched/exec.h)

Enumerator
N_UNDF 

Undefined.

N_ABS 

Absolute.

N_TEXT 

Text.

N_DATA 

Data.

N_BSS 

BSS.

N_COMM 

Common (internal to ld).

N_FN 

File name.

N_EXT 

Mask bit for external.

N_TYPE 

Mask bits for resolving symbol type.

N_TJ 

Table jump.

N_JTE 

Jump table entry.

N_MEM 

Memory reference.

N_FC 

Function call.

N_STAB 

Mask for stabs.

N_GSYM 

Global.

N_FNAME 

Procedure name (f77).

N_FUN 

Procedure.

N_STSYM 

Static.

N_LCSYM 

.lcomm.

N_MAIN 

Name of main rutine.

N_RSYM 

Register.

N_SLINE 

Source line.

N_SSYM 

Structure.

N_SO 

Source file name.

N_LSYM 

Local.

N_BINCL 

Header file.

N_SOL 

#included file name.

N_PSYM 

Parameter.

N_EINCL 

End of include file.

N_LBRAC 

Left bracket.

N_EXCL 

Excluded include file.

N_RBRAC 

Right bracket.

N_BCOMM 

Begin common.

N_ECOMM 

End common.

N_ECOML 

End common (local name).

N_LENG 

Second symbol table entry with length.

N_PC 

Global pascal symbol.

N_M2C 

Compilation unit symbol table entry.

N_SCOPE 

Scope information.

N_BROWS 

Sun source code browser.

N_PRTAB 

TCE processors resource entry.

N_ANN 

TCE annotation entry.

Definition at line 61 of file AOutReader.hh.

61  {
62  N_UNDF = 0x0, ///< Undefined.
63  N_ABS = 0x2, ///< Absolute.
64  N_TEXT = 0x4, ///< Text.
65  N_DATA = 0x6, ///< Data.
66  N_BSS = 0x8, ///< BSS.
67  N_COMM = 0x12, ///< Common (internal to ld).
68  N_FN = 0x1e, ///< File name.
69  N_EXT = 0x1, ///< Mask bit for external.
70  N_TYPE = 0x1e, ///< Mask bits for resolving symbol type.
71  N_TJ = 0x76, ///< Table jump.
72  N_JTE = 0x96, ///< Jump table entry.
73  N_MEM = 0xb6, ///< Memory reference.
74  N_FC = 0xd6, ///< Function call.
75  N_STAB = 0xe0, ///< Mask for stabs.
76  N_GSYM = 0x20, ///< Global.
77  N_FNAME = 0x22, ///< Procedure name (f77).
78  N_FUN = 0x24, ///< Procedure.
79  N_STSYM = 0x26, ///< Static.
80  N_LCSYM = 0x28, ///< .lcomm.
81  N_MAIN = 0x2a, ///< Name of main rutine.
82  N_RSYM = 0x40, ///< Register.
83  N_SLINE = 0x44, ///< Source line.
84  N_SSYM = 0x60, ///< Structure.
85  N_SO = 0x64, ///< Source file name.
86  N_LSYM = 0x80, ///< Local.
87  N_BINCL = 0x82, ///< Header file.
88  N_SOL = 0x84, ///< #included file name.
89  N_PSYM = 0xa0, ///< Parameter.
90  N_EINCL = 0xa2, ///< End of include file.
91  N_LBRAC = 0xc0, ///< Left bracket.
92  N_EXCL = 0xc2, ///< Excluded include file.
93  N_RBRAC = 0xe0, ///< Right bracket.
94  N_BCOMM = 0xe2, ///< Begin common.
95  N_ECOMM = 0xe4, ///< End common.
96  N_ECOML = 0xe8, ///< End common (local name).
97  N_LENG = 0xfe, ///< Second symbol table entry with length.
98  N_PC = 0x30, ///< Global pascal symbol.
99  N_M2C = 0x42, ///< Compilation unit symbol table entry.
100  N_SCOPE = 0xc4, ///< Scope information.
101  N_BROWS = 0x48, ///< Sun source code browser.
102  N_PRTAB = 0xd2, ///< TCE processors resource entry.
103  N_ANN = 0xa4 ///< TCE annotation entry.
104  };

Constructor & Destructor Documentation

◆ AOutReader() [1/2]

TPEF::AOutReader::AOutReader ( )
protected

Constructor.

Creates Header and registers itself to BinaryReader.

Definition at line 101 of file AOutReader.cc.

101  : BinaryReader(),
102  codeASpace_(NULL), dataASpace_(NULL) {
103 
105 }

References TPEF::BinaryReader::registerBinaryReader().

Here is the call graph for this function:

◆ ~AOutReader()

TPEF::AOutReader::~AOutReader ( )
protectedvirtual

Destructor.

Definition at line 110 of file AOutReader.cc.

110  {
111 
112  if (proto_ != NULL) {
113  auto proto = proto_;
114  proto_ = NULL;
115  delete proto;
116  }
117 }

References proto_.

◆ AOutReader() [2/2]

TPEF::AOutReader::AOutReader ( const AOutReader )
private

Copying not allowed.

Member Function Documentation

◆ addOrDeleteSection()

void TPEF::AOutReader::addOrDeleteSection ( Section section,
Binary binary 
) const
private

Referenced by readData().

◆ addressOfElement()

AddressImage TPEF::AOutReader::addressOfElement ( SectionElement elem) const

◆ aSpaceOfElement()

ASpaceElement* TPEF::AOutReader::aSpaceOfElement ( SectionElement elem) const

◆ debugSection()

DebugSection* TPEF::AOutReader::debugSection ( ) const

◆ header()

static const Header& TPEF::AOutReader::header ( )
static

◆ instance()

static BinaryReader* TPEF::AOutReader::instance ( )
static

◆ isMyStreamType()

bool TPEF::AOutReader::isMyStreamType ( BinaryStream stream) const
protectedvirtual

Checks whether AOutReader can read from the given stream.

The test simply consists of checking that file size is at least the size of a.out header. Then it checks whether the third and fourth Byte of stream match the magic number of a.out files. Only 'old impure format' files (not read-only text and not page-aligned for on demand load) are accepted.

This method does not modify the stream position.

Parameters
streamThe stream to test.
Returns
True if stream contains data in a.out format, false otherwise.
Exceptions
UnreachableStreamIf there occurs an exception with stream.

Implements TPEF::BinaryReader.

Definition at line 341 of file AOutReader.cc.

341  {
342  unsigned long startPos = stream.readPosition();
343 
344  try {
345  if (stream.sizeOfFile() < FILE_HEADER_SIZE) {
346  return false;
347  } else {
348  stream.readHalfWord();
349  Word magic = stream.readHalfWord();
350 
351  stream.setReadPosition(startPos);
352 
353  if(magic == OMAGIC) {
354  return true;
355  } else {
356  return false;
357  }
358  }
359 
360  } catch (EndOfFile& e) {
361  stream.setReadPosition(startPos);
362  return false;
363  }
364 }

References FILE_HEADER_SIZE, OMAGIC, TPEF::BinaryStream::readHalfWord(), TPEF::BinaryStream::readPosition(), TPEF::BinaryStream::setReadPosition(), and TPEF::BinaryStream::sizeOfFile().

Here is the call graph for this function:

◆ nullSection()

NullSection* TPEF::AOutReader::nullSection ( ) const

◆ operator=()

AOutReader& TPEF::AOutReader::operator= ( const AOutReader )
private

Assignment not allowed.

◆ readData()

Binary * TPEF::AOutReader::readData ( BinaryStream stream) const
protectedvirtual

Does the actual work of reading binary file from stream.

Reads a.out binary file and creates valid TPEF object hierarchy out of it.

Parameters
streamStream to be read from.
Returns
Pointer to the Binary object created.
Exceptions
UnreachableStreamIf reading of section fails.
KeyAlreadyExistsKey was in use when trying to register object.
EndOfFileIf end of file were reached while it shouldn't.
OutOfRangeSome of read values were out of range.
WrongSubclassSome class couldn't do what it was asked for.
UnexpectedValueIf there was unexpected value when reading.

Implements TPEF::BinaryReader.

Definition at line 134 of file AOutReader.cc.

134  {
135  Binary* newBin = NULL;
136  newBin = new Binary();
137 
138  // read section sizes and other file header data
139  readHeader(stream);
140 
141  // create all a.out sections and
142  nullSection_ =
143  dynamic_cast<NullSection*>(
146 
147  textSection_ = dynamic_cast<CodeSection*>(
149 
150  DataSection* dataSection = dynamic_cast<DataSection*>(
152 
153  UDataSection* uDataSection = dynamic_cast<UDataSection*>(
155 
156  stringSection_ = dynamic_cast<StringSection*>(
159 
160  Section* symbolTable = Section::createSection(Section::ST_SYMTAB);
161 
162  RelocSection* textRelocSection = dynamic_cast<RelocSection*>(
164 
165  RelocSection* dataRelocSection = dynamic_cast<RelocSection*>(
167 
168  debugSection_ = dynamic_cast<DebugSection*>(
171 
172 
173  // create TPEF needed sections (NullSection and ASpaceSection)
174  // and processors resource table
175  resourceTable_ = dynamic_cast<ResourceSection*>
177 
178  ASpaceSection* aSpaceSection = dynamic_cast<ASpaceSection*>(
180 
181  newBin->setStrings(stringSection_);
182  SectionOffsetKey nullString(ST_STRING, 0);
183 
184  undefASpace_ = new ASpaceElement();
185 
186  codeASpace_ = new ASpaceElement();
190 
191  dataASpace_ = new ASpaceElement();
195 
196  aSpaceSection->setUndefinedASpace(undefASpace_);
197  aSpaceSection->addElement(undefASpace_);
198  aSpaceSection->addElement(codeASpace_);
199  aSpaceSection->addElement(dataASpace_);
200  aSpaceSection->setLink(stringSection_);
201 
202  // set addresses and address spaces
203 
204  // code section starts from address zero
208 
209  // after that comes data section
210  dataSection->setASpace(dataASpace_);
211  dataSection->setStartingAddress(header_.sectionSizeText());
212  dataSection->setLink(nullSection_);
213 
214  // and at last uninitilized data section after that
215  uDataSection->setASpace(dataASpace_);
216  uDataSection->setStartingAddress(
218  uDataSection->setLink(nullSection_);
219 
220  // undefined address spaces for all aux sections
223  aSpaceSection->setASpace(undefASpace_);
225  symbolTable->setASpace(undefASpace_);
226  textRelocSection->setASpace(undefASpace_);
227  dataRelocSection->setASpace(undefASpace_);
228 
231 
232  FileOffset textSection_Start = stream.readPosition();
233 
234  FileOffset dataSectionStart =
235  textSection_Start + header_.sectionSizeText();
236 
237  FileOffset textRelocationTableStart =
238  dataSectionStart + header_.sectionSizeData();
239 
240  FileOffset dataRelocationTableStart =
241  textRelocationTableStart + header_.sectionSizeTextReloc();
242 
243  FileOffset symbolTableStart =
244  dataRelocationTableStart + header_.sectionSizeDataReloc();
245 
246  FileOffset stringTableStart =
247  symbolTableStart + header_.sectionSizeSymbol();
248 
249  // reading sections and creating reference keys
250  SafePointer::addObjectReference(SectionKey(ST_UDATA), uDataSection);
251  uDataSection->setDataLength(header_.sectionSizeUData());
252 
254  readSection(stream, stringTableStart, stringSection_,
256 
258  readSection(stream, textSection_Start,
260 
261  SafePointer::addObjectReference(SectionKey(ST_DATA), dataSection);
262  readSection(stream, dataSectionStart,
263  dataSection, header_.sectionSizeData());
264 
265  SafePointer::addObjectReference(SectionKey(ST_SYMBOL), symbolTable);
266  symbolTable->setLink(stringSection_);
267  readSection(stream, symbolTableStart,
268  symbolTable, header_.sectionSizeSymbol());
269 
270  // relocation sections are not referenced anywhere by SectionId
271  textRelocSection->setLink(symbolTable);
272  textRelocSection->setReferencedSection(textSection_);
273  readSection(stream, textRelocationTableStart,
274  textRelocSection, header_.sectionSizeTextReloc());
275 
276  dataRelocSection->setLink(symbolTable);
277  dataRelocSection->setReferencedSection(dataSection);
278  readSection(stream, dataRelocationTableStart,
279  dataRelocSection, header_.sectionSizeDataReloc());
280 
281  // add sections necessary sections and sections that contained elements
282  newBin->addSection(nullSection_);
283  newBin->addSection(aSpaceSection);
284 
285  // set names for sections and address spaces
286  symbolTable->setName(stringSection_->string2Chunk("Symbols"));
288  stringSection_->string2Chunk("Universal resources"));
289  dataSection->setName(stringSection_->string2Chunk("Initialized data"));
291  aSpaceSection->setName(stringSection_->string2Chunk("Address spaces"));
292  nullSection_->setName(stringSection_->string2Chunk("Null section"));
293  uDataSection->setName(stringSection_->string2Chunk("Uninitilized data"));
294  textRelocSection->setName(
295  stringSection_->string2Chunk("Relocated immediates"));
296  dataRelocSection->setName(stringSection_->string2Chunk("Relocated data"));
297  stringSection_->setName(stringSection_->string2Chunk("Strings of TPEF"));
299 
303 
305  addOrDeleteSection(textRelocSection, newBin);
306  addOrDeleteSection(symbolTable, newBin);
307  addOrDeleteSection(dataSection, newBin);
308  addOrDeleteSection(dataRelocSection, newBin);
309  addOrDeleteSection(uDataSection, newBin);
312 
313  // there should be always at least one starting zero
314  assert(stringSection_->length() > 0);
315  newBin->addSection(stringSection_);
316 
317  // can't be sure about these, but external clients will fix
318  // values if needed
319  newBin->setType(Binary::FT_OBJSEQ);
320  newBin->setArch(Binary::FA_TTA_TUT);
321 
322  return newBin;
323 }

References TPEF::Section::addElement(), TPEF::ReferenceManager::SafePointer::addObjectReference(), addOrDeleteSection(), TPEF::Binary::addSection(), AOUT_BITS_PER_MAU, AOUT_CODE_ASPACE_NAME, AOUT_DATA_ASPACE_NAME, AOUT_WORD_ALIGN, AOUT_WORD_SIZE, assert, codeASpace_, TPEF::Section::createSection(), dataASpace_, debugSection_, TPEF::Binary::FA_TTA_TUT, TPEF::Binary::FT_OBJSEQ, header_, TPEF::DataSection::length(), nullSection_, readHeader(), TPEF::BinaryStream::readPosition(), readSection(), resourceTable_, TPEF::AOutReader::Header::sectionSizeData(), TPEF::AOutReader::Header::sectionSizeDataReloc(), TPEF::AOutReader::Header::sectionSizeString(), TPEF::AOutReader::Header::sectionSizeSymbol(), TPEF::AOutReader::Header::sectionSizeText(), TPEF::AOutReader::Header::sectionSizeTextReloc(), TPEF::AOutReader::Header::sectionSizeUData(), TPEF::ASpaceElement::setAlign(), TPEF::Binary::setArch(), TPEF::Section::setASpace(), TPEF::RawSection::setDataLength(), TPEF::Section::setLink(), TPEF::ASpaceElement::setMAU(), TPEF::ASpaceElement::setName(), TPEF::Section::setName(), TPEF::RelocSection::setReferencedSection(), TPEF::Section::setStartingAddress(), TPEF::Binary::setStrings(), TPEF::Binary::setType(), TPEF::ASpaceSection::setUndefinedASpace(), TPEF::ASpaceElement::setWordSize(), TPEF::Section::ST_ADDRSP, TPEF::Section::ST_CODE, TPEF::Section::ST_DATA, ST_DATA, TPEF::Section::ST_DEBUG, TPEF::Section::ST_MR, TPEF::Section::ST_NULL, TPEF::Section::ST_RELOC, ST_STRING, TPEF::Section::ST_STRTAB, ST_SYMBOL, TPEF::Section::ST_SYMTAB, ST_TEXT, TPEF::Section::ST_UDATA, ST_UDATA, TPEF::StringSection::string2Chunk(), stringSection_, textSection_, and undefASpace_.

Here is the call graph for this function:

◆ readHeader()

void TPEF::AOutReader::readHeader ( BinaryStream stream) const
private

Reads file header from the stream and stores it to a specific object.

Parameters
streamStream to be read from.
Exceptions
UnreachableStreamIf there occurs a problem with stream.
EndOfFileIf end of file were reached where it shouldn't.

Definition at line 374 of file AOutReader.cc.

374  {
375  // test magic number again just in case...
376  stream.readHalfWord();
377  assert(stream.readHalfWord() == OMAGIC);
378 
379  header_.setSectionSizeText(stream.readWord());
380  header_.setSectionSizeData(stream.readWord());
381  header_.setSectionSizeUData(stream.readWord());
382  header_.setSectionSizeSymbol(stream.readWord());
383 
384  // virtual address of the entry point of the program is ignored
385  assert(stream.readWord() == 0);
386 
387  header_.setSectionSizeTextReloc(stream.readWord());
388  header_.setSectionSizeDataReloc(stream.readWord());
389 
390  SectionOffset currentPosition = stream.readPosition();
391 
392  // calculate the size of string table
393  SectionOffset beginOfStrTable = currentPosition +
397 
398  header_.setSectionSizeString(stream.sizeOfFile() -
399  beginOfStrTable);
400 }

References assert, header_, OMAGIC, TPEF::BinaryStream::readHalfWord(), TPEF::BinaryStream::readPosition(), TPEF::BinaryStream::readWord(), TPEF::AOutReader::Header::sectionSizeData(), TPEF::AOutReader::Header::sectionSizeDataReloc(), TPEF::AOutReader::Header::sectionSizeSymbol(), TPEF::AOutReader::Header::sectionSizeText(), TPEF::AOutReader::Header::sectionSizeTextReloc(), TPEF::AOutReader::Header::setSectionSizeData(), TPEF::AOutReader::Header::setSectionSizeDataReloc(), TPEF::AOutReader::Header::setSectionSizeString(), TPEF::AOutReader::Header::setSectionSizeSymbol(), TPEF::AOutReader::Header::setSectionSizeText(), TPEF::AOutReader::Header::setSectionSizeTextReloc(), TPEF::AOutReader::Header::setSectionSizeUData(), and TPEF::BinaryStream::sizeOfFile().

Referenced by readData().

Here is the call graph for this function:

◆ readSection()

void TPEF::AOutReader::readSection ( BinaryStream stream,
FileOffset  startPosition,
Section section,
Length  length 
) const
private

Referenced by readData().

◆ resourceTable()

ResourceSection* TPEF::AOutReader::resourceTable ( ) const

◆ sectionOffsetOfAddress()

SectionOffset TPEF::AOutReader::sectionOffsetOfAddress ( AddressImage  address) const

◆ stringSection()

StringSection* TPEF::AOutReader::stringSection ( ) const

◆ textSection()

CodeSection* TPEF::AOutReader::textSection ( ) const

Member Data Documentation

◆ AOUT_BITS_PER_MAU

const Byte TPEF::AOutReader::AOUT_BITS_PER_MAU = 8
static

Minimum addressable word of address space.

Definition at line 143 of file AOutReader.hh.

Referenced by readData().

◆ AOUT_CODE_ASPACE_NAME

const char * TPEF::AOutReader::AOUT_CODE_ASPACE_NAME = "universal_instructions"
static

Name of universal machines code address space.

Definition at line 150 of file AOutReader.hh.

Referenced by readData().

◆ AOUT_DATA_ASPACE_NAME

const char * TPEF::AOutReader::AOUT_DATA_ASPACE_NAME = "universal_data"
static

Name of universal machines data address space.

Definition at line 152 of file AOutReader.hh.

Referenced by readData().

◆ AOUT_INSTRUCTION_SIZE

const Byte TPEF::AOutReader::AOUT_INSTRUCTION_SIZE = 8
static

Size of one instruction in a.out file.

Definition at line 140 of file AOutReader.hh.

◆ AOUT_WORD_ALIGN

const Byte TPEF::AOutReader::AOUT_WORD_ALIGN = 4
static

Aligment of address space.

Definition at line 145 of file AOutReader.hh.

Referenced by readData().

◆ AOUT_WORD_SIZE

const Byte TPEF::AOutReader::AOUT_WORD_SIZE = 4
static

Word size of address space.

Definition at line 147 of file AOutReader.hh.

Referenced by readData().

◆ BOOL_REGISTERS

const Word TPEF::AOutReader::BOOL_REGISTERS = 1
static

Number of Boolean registers.

Definition at line 128 of file AOutReader.hh.

◆ codeASpace_

ASpaceElement* TPEF::AOutReader::codeASpace_
mutableprivate

Address space of text section.

Definition at line 237 of file AOutReader.hh.

Referenced by readData().

◆ dataASpace_

ASpaceElement* TPEF::AOutReader::dataASpace_
mutableprivate

Address space of data sections.

Definition at line 239 of file AOutReader.hh.

Referenced by readData().

◆ debugSection_

DebugSection * TPEF::AOutReader::debugSection_ = NULL
staticprivate

Definition at line 248 of file AOutReader.hh.

Referenced by readData().

◆ FILE_HEADER_SIZE

const Byte TPEF::AOutReader::FILE_HEADER_SIZE = 8 * sizeof(Word)
staticprivate

Size of file header.

Definition at line 259 of file AOutReader.hh.

Referenced by isMyStreamType().

◆ FIRST_BOOL_REGISTER

const Word TPEF::AOutReader::FIRST_BOOL_REGISTER = FIRST_FP_REGISTER + FP_REGISTERS
static

◆ FIRST_FP_REGISTER

const Word TPEF::AOutReader::FIRST_FP_REGISTER = FIRST_INT_REGISTER + INT_REGISTERS
static

◆ FIRST_FU_REGISTER

const Word TPEF::AOutReader::FIRST_FU_REGISTER = FIRST_BOOL_REGISTER + BOOL_REGISTERS
static

◆ FIRST_INT_REGISTER

const Word TPEF::AOutReader::FIRST_INT_REGISTER = 0
static

Index of the first integer register in a.out.

Definition at line 131 of file AOutReader.hh.

Referenced by TPEF::AOutTextSectionReader::convertAOutIndexToTPEF().

◆ FP_REGISTERS

const Word TPEF::AOutReader::FP_REGISTERS = 1024
static

Number of floating-point registers.

Definition at line 126 of file AOutReader.hh.

◆ header_

AOutReader::Header TPEF::AOutReader::header_
staticprivate

Header of a.out file.

Definition at line 262 of file AOutReader.hh.

Referenced by readData(), and readHeader().

◆ INT_REGISTERS

const Word TPEF::AOutReader::INT_REGISTERS = 1024
static

Number of integer registers.

Definition at line 124 of file AOutReader.hh.

◆ nullSection_

NullSection * TPEF::AOutReader::nullSection_ = NULL
staticprivate

Definition at line 245 of file AOutReader.hh.

Referenced by readData().

◆ OMAGIC

const HalfWord TPEF::AOutReader::OMAGIC = 0x0107
staticprivate

Move a.out format identifier.

Definition at line 257 of file AOutReader.hh.

Referenced by isMyStreamType(), and readHeader().

◆ proto_

AOutReader * TPEF::AOutReader::proto_ = NULL
staticprivate

Prototype instance of AOutReader registered into BinaryReader.

AOutReader class.

Definition at line 264 of file AOutReader.hh.

Referenced by ~AOutReader().

◆ resourceTable_

ResourceSection * TPEF::AOutReader::resourceTable_ = NULL
staticprivate

Definition at line 242 of file AOutReader.hh.

Referenced by readData().

◆ stringSection_

StringSection * TPEF::AOutReader::stringSection_ = NULL
staticprivate

Definition at line 251 of file AOutReader.hh.

Referenced by readData().

◆ textSection_

CodeSection * TPEF::AOutReader::textSection_ = NULL
staticprivate

Definition at line 254 of file AOutReader.hh.

Referenced by readData().

◆ undefASpace_

ASpaceElement* TPEF::AOutReader::undefASpace_
mutableprivate

Undefined address space.

Definition at line 235 of file AOutReader.hh.

Referenced by readData().


The documentation for this class was generated from the following files:
TPEF::AOutReader::Header::setSectionSizeDataReloc
void setSectionSizeDataReloc(Word size)
TPEF::AOutReader::N_FUN
@ N_FUN
Procedure.
Definition: AOutReader.hh:78
TPEF::AOutReader::N_MEM
@ N_MEM
Memory reference.
Definition: AOutReader.hh:73
TPEF::Section::ST_SYMTAB
@ ST_SYMTAB
Symbol table.
Definition: Section.hh:72
TPEF::AOutReader::FILE_HEADER_SIZE
static const Byte FILE_HEADER_SIZE
Size of file header.
Definition: AOutReader.hh:259
TPEF::AOutReader::N_EXT
@ N_EXT
Mask bit for external.
Definition: AOutReader.hh:69
TPEF::AOutReader::N_RBRAC
@ N_RBRAC
Right bracket.
Definition: AOutReader.hh:93
TPEF::AOutReader::N_TJ
@ N_TJ
Table jump.
Definition: AOutReader.hh:71
TPEF::Section::ST_DEBUG
@ ST_DEBUG
Debug section.
Definition: Section.hh:73
TPEF::AOutReader::N_PRTAB
@ N_PRTAB
TCE processors resource entry.
Definition: AOutReader.hh:102
TPEF::AOutReader::resourceTable_
static ResourceSection * resourceTable_
Definition: AOutReader.hh:242
TPEF::AOutReader::N_BCOMM
@ N_BCOMM
Begin common.
Definition: AOutReader.hh:94
TPEF::ASpaceElement::setAlign
void setAlign(Byte aAlign)
TPEF::Binary::FA_TTA_TUT
@ FA_TTA_TUT
New TTA template.
Definition: Binary.hh:70
TPEF::AOutReader::N_MAIN
@ N_MAIN
Name of main rutine.
Definition: AOutReader.hh:81
TPEF::AOutReader::textSection_
static CodeSection * textSection_
Definition: AOutReader.hh:254
TPEF::AOutReader::N_SO
@ N_SO
Source file name.
Definition: AOutReader.hh:85
TPEF::AOutReader::Header::setSectionSizeData
void setSectionSizeData(Word size)
TPEF::AOutReader::N_PSYM
@ N_PSYM
Parameter.
Definition: AOutReader.hh:89
TPEF::AOutReader::Header::setSectionSizeText
void setSectionSizeText(Word size)
TPEF::AOutReader::codeASpace_
ASpaceElement * codeASpace_
Address space of text section.
Definition: AOutReader.hh:237
TPEF::AOutReader::AOUT_CODE_ASPACE_NAME
static const char * AOUT_CODE_ASPACE_NAME
Name of universal machines code address space.
Definition: AOutReader.hh:150
TPEF::AOutReader::Header::setSectionSizeString
void setSectionSizeString(Word size)
TPEF::AOutReader::N_BINCL
@ N_BINCL
Header file.
Definition: AOutReader.hh:87
TPEF::AOutReader::N_LSYM
@ N_LSYM
Local.
Definition: AOutReader.hh:86
TPEF::AOutReader::AOUT_BITS_PER_MAU
static const Byte AOUT_BITS_PER_MAU
Minimum addressable word of address space.
Definition: AOutReader.hh:143
TPEF::ReferenceManager::SafePointer::addObjectReference
static void addObjectReference(SectionIndexKey key, const SafePointable *obj)
Definition: SafePointer.cc:306
assert
#define assert(condition)
Definition: Application.hh:86
TPEF::AOutReader::N_SCOPE
@ N_SCOPE
Scope information.
Definition: AOutReader.hh:100
TPEF::AOutReader::AOUT_WORD_ALIGN
static const Byte AOUT_WORD_ALIGN
Aligment of address space.
Definition: AOutReader.hh:145
TPEF::AOutReader::ST_UDATA
@ ST_UDATA
Uninitialized data section.
Definition: AOutReader.hh:118
TPEF::AOutReader::readHeader
void readHeader(BinaryStream &stream) const
Definition: AOutReader.cc:374
TPEF::AOutReader::Header::sectionSizeSymbol
Word sectionSizeSymbol() const
TPEF::AOutReader::N_ANN
@ N_ANN
TCE annotation entry.
Definition: AOutReader.hh:103
TPEF::AOutReader::addOrDeleteSection
void addOrDeleteSection(Section *section, Binary *binary) const
TPEF::ASpaceElement::setWordSize
void setWordSize(Byte aWordSize)
TPEF::Section::ST_DATA
@ ST_DATA
Initialized data section.
Definition: Section.hh:80
TPEF::AOutReader::N_TEXT
@ N_TEXT
Text.
Definition: AOutReader.hh:64
TPEF::AOutReader::N_DATA
@ N_DATA
Data.
Definition: AOutReader.hh:65
TPEF::Section::createSection
static Section * createSection(SectionType type)
Definition: Section.cc:91
TPEF::AOutReader::header_
static Header header_
Header of a.out file.
Definition: AOutReader.hh:262
TPEF::AOutReader::N_FC
@ N_FC
Function call.
Definition: AOutReader.hh:74
TPEF::StringSection::string2Chunk
Chunk * string2Chunk(const std::string &str)
Definition: StringSection.cc:103
TPEF::FileOffset
Word FileOffset
Type for storing absolute file offsets.
Definition: TPEFBaseType.hh:52
TPEF::AOutReader::N_COMM
@ N_COMM
Common (internal to ld).
Definition: AOutReader.hh:67
TPEF::AOutReader::Header::setSectionSizeSymbol
void setSectionSizeSymbol(Word size)
TPEF::AOutReader::Header::setSectionSizeTextReloc
void setSectionSizeTextReloc(Word size)
TPEF::AOutReader::N_EXCL
@ N_EXCL
Excluded include file.
Definition: AOutReader.hh:92
TPEF::AOutReader::debugSection_
static DebugSection * debugSection_
Definition: AOutReader.hh:248
TPEF::AOutReader::stringSection_
static StringSection * stringSection_
Definition: AOutReader.hh:251
TPEF::AOutReader::ST_TEXT
@ ST_TEXT
Text section.
Definition: AOutReader.hh:116
TPEF::AOutReader::N_PC
@ N_PC
Global pascal symbol.
Definition: AOutReader.hh:98
TPEF::AOutReader::AOUT_DATA_ASPACE_NAME
static const char * AOUT_DATA_ASPACE_NAME
Name of universal machines data address space.
Definition: AOutReader.hh:152
TPEF::Section::setName
void setName(const ReferenceManager::SafePointer *sectionName)
TPEF::AOutReader::N_FN
@ N_FN
File name.
Definition: AOutReader.hh:68
TPEF::AOutReader::N_SLINE
@ N_SLINE
Source line.
Definition: AOutReader.hh:83
TPEF::Section::setStartingAddress
void setStartingAddress(AddressImage address)
TPEF::AOutReader::Header::sectionSizeString
Word sectionSizeString() const
TPEF::Section::ST_UDATA
@ ST_UDATA
Uninitialized data section.
Definition: Section.hh:81
TPEF::AOutReader::N_EINCL
@ N_EINCL
End of include file.
Definition: AOutReader.hh:90
TPEF::AOutReader::Header::sectionSizeUData
Word sectionSizeUData() const
TPEF::AOutReader::N_BSS
@ N_BSS
BSS.
Definition: AOutReader.hh:66
TPEF::SectionOffset
Word SectionOffset
Type for storing offsets relative to a given base offset value.
Definition: TPEFBaseType.hh:49
TPEF::AOutReader::N_SSYM
@ N_SSYM
Structure.
Definition: AOutReader.hh:84
TPEF::AOutReader::N_RSYM
@ N_RSYM
Register.
Definition: AOutReader.hh:82
TPEF::ASpaceElement::setMAU
void setMAU(Byte aMAU)
TPEF::BinaryReader::BinaryReader
BinaryReader()
Definition: BinaryReader.cc:58
TPEF::AOutReader::Header::sectionSizeTextReloc
Word sectionSizeTextReloc() const
TPEF::AOutReader::ST_UNDEF
@ ST_UNDEF
Undefined section.
Definition: AOutReader.hh:115
TPEF::AOutReader::N_STAB
@ N_STAB
Mask for&#160;stabs.
Definition: AOutReader.hh:75
TPEF::Section::ST_STRTAB
@ ST_STRTAB
String table.
Definition: Section.hh:71
TPEF::Section::setASpace
void setASpace(const ReferenceManager::SafePointer *addrSpace)
TPEF::AOutReader::N_STSYM
@ N_STSYM
Static.
Definition: AOutReader.hh:79
TPEF::AOutReader::Header::sectionSizeData
Word sectionSizeData() const
TPEF::AOutReader::undefASpace_
ASpaceElement * undefASpace_
Undefined address space.
Definition: AOutReader.hh:235
TPEF::AOutReader::Header::sectionSizeDataReloc
Word sectionSizeDataReloc() const
TPEF::AOutReader::readSection
void readSection(BinaryStream &stream, FileOffset startPosition, Section *section, Length length) const
TPEF::AOutReader::N_M2C
@ N_M2C
Compilation unit symbol table entry.
Definition: AOutReader.hh:99
TPEF::AOutReader::N_FNAME
@ N_FNAME
Procedure name (f77).
Definition: AOutReader.hh:77
TPEF::AOutReader::N_JTE
@ N_JTE
Jump table entry.
Definition: AOutReader.hh:72
TPEF::Section::ST_RELOC
@ ST_RELOC
Relocation section.
Definition: Section.hh:74
TPEF::Section::setLink
void setLink(const ReferenceManager::SafePointer *aLink)
TPEF::ASpaceElement::setName
void setName(const ReferenceManager::SafePointer *aName)
TPEF::AOutReader::N_LBRAC
@ N_LBRAC
Left bracket.
Definition: AOutReader.hh:91
TPEF::AOutReader::Header::setSectionSizeUData
void setSectionSizeUData(Word size)
TPEF::AOutReader::ST_SYMBOL
@ ST_SYMBOL
Symbol table.
Definition: AOutReader.hh:119
TPEF::AOutReader::N_SOL
@ N_SOL
#included file name.
Definition: AOutReader.hh:88
TPEF::AOutReader::N_BROWS
@ N_BROWS
Sun source code browser.
Definition: AOutReader.hh:101
TPEF::AOutReader::OMAGIC
static const HalfWord OMAGIC
Move a.out format identifier.
Definition: AOutReader.hh:257
TPEF::AOutReader::N_ABS
@ N_ABS
Absolute.
Definition: AOutReader.hh:63
TPEF::DataSection::length
virtual Word length() const
Definition: DataSection.cc:210
TPEF::AOutReader::N_LCSYM
@ N_LCSYM
.lcomm.
Definition: AOutReader.hh:80
TPEF::Section::ST_NULL
@ ST_NULL
NULL Section.
Definition: Section.hh:70
TPEF::AOutReader::N_ECOMM
@ N_ECOMM
End common.
Definition: AOutReader.hh:95
TPEF::AOutReader::N_LENG
@ N_LENG
Second symbol table entry with length.
Definition: AOutReader.hh:97
TPEF::Section::ST_CODE
@ ST_CODE
Text section.
Definition: Section.hh:79
EndOfFile
Definition: Exception.hh:189
TPEF::Section::ST_MR
@ ST_MR
Machine resources section.
Definition: Section.hh:78
TPEF::AOutReader::AOUT_WORD_SIZE
static const Byte AOUT_WORD_SIZE
Word size of address space.
Definition: AOutReader.hh:147
TPEF::AOutReader::proto_
static AOutReader * proto_
Prototype instance of AOutReader registered into BinaryReader.
Definition: AOutReader.hh:264
TPEF::AOutReader::N_UNDF
@ N_UNDF
Undefined.
Definition: AOutReader.hh:62
TPEF::AOutReader::ST_DATA
@ ST_DATA
Data section.
Definition: AOutReader.hh:117
TPEF::AOutReader::nullSection_
static NullSection * nullSection_
Definition: AOutReader.hh:245
TPEF::AOutReader::Header::sectionSizeText
Word sectionSizeText() const
TPEF::AOutReader::N_GSYM
@ N_GSYM
Global.
Definition: AOutReader.hh:76
TPEF::Binary::FT_OBJSEQ
@ FT_OBJSEQ
Sequential TTA object code.
Definition: Binary.hh:56
TPEF::Section::ST_ADDRSP
@ ST_ADDRSP
Address space section.
Definition: Section.hh:77
TPEF::AOutReader::N_ECOML
@ N_ECOML
End common (local name).
Definition: AOutReader.hh:96
TPEF::AOutReader::dataASpace_
ASpaceElement * dataASpace_
Address space of data sections.
Definition: AOutReader.hh:239
TPEF::AOutReader::N_TYPE
@ N_TYPE
Mask bits for resolving symbol type.
Definition: AOutReader.hh:70
TPEF::BinaryReader::registerBinaryReader
static void registerBinaryReader(BinaryReader *reader)
Definition: BinaryReader.cc:165
TPEF::AOutReader::ST_STRING
@ ST_STRING
String table.
Definition: AOutReader.hh:120