00001 #ifndef _RelocationTable_h_ 00002 #define _RelocationTable_h_ 00003 00004 #include <Base.h> 00005 #include <defines/RelocationTable.d> 00006 00007 class SymbolTable; 00008 class XCoffFile; 00009 00010 class Relocation { 00011 protected: 00012 Relocation() {} 00013 virtual ~Relocation() {} 00014 public: 00015 virtual char* charStream() { __SHOULD_NOT_ARRIVE; return NULL; } 00016 virtual void print(SymbolTable* symbolTable,uint32_t index); 00017 00018 RELOCATION_MACROS_BASIS("For the get_X field macros check the defines directory"); 00019 }; 00020 00021 class Relocation32 : public Relocation { 00022 protected: 00023 RELOC entry; 00024 public: 00025 Relocation32() {} 00026 ~Relocation32() {} 00027 char* charStream() { return (char*)&entry; } 00028 00029 RELOCATION_MACROS_CLASS("For the get_X field macros check the defines directory"); 00030 }; 00031 00032 class Relocation64 : public Relocation { 00033 protected: 00034 RELOC_64 entry; 00035 public: 00036 Relocation64() {} 00037 ~Relocation64() {} 00038 char* charStream() { return (char*)&entry; } 00039 00040 RELOCATION_MACROS_CLASS("For the get_X field macros check the defines directory"); 00041 }; 00042 00043 class RelocationTable : public Base { 00044 protected: 00045 00046 char* relocationPtr; 00047 uint32_t numOfRelocations; 00048 00049 Relocation** relocations; 00050 00051 SymbolTable* symbolTable; 00052 00053 XCoffFile* xCoffFile; 00054 00055 00056 public: 00057 00058 RelocationTable(char* ptr,uint32_t s,XCoffFile* xcoff); 00059 void print(); 00060 uint32_t read(BinaryInputFile* b); 00061 00062 void setSymbolTable(SymbolTable* st) { symbolTable = st; } 00063 00064 XCoffFile* getXCoffFile() { return xCoffFile; } 00065 00066 const char* briefName() { return "RelocationTable"; } 00067 uint32_t instrument(char* buffer,XCoffFileGen* xCoffGen,BaseGen* gen); 00068 }; 00069 00070 #endif 00071