Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

pefstruc.h

Go to the documentation of this file.
00001 /* 
00002  *      HT Editor
00003  *      peffstruc.h
00004  *
00005  *      Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de)
00006  *
00007  *      This program is free software; you can redistribute it and/or modify
00008  *      it under the terms of the GNU General Public License version 2 as
00009  *      published by the Free Software Foundation.
00010  *
00011  *      This program is distributed in the hope that it will be useful,
00012  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *      GNU General Public License for more details.
00015  *
00016  *      You should have received a copy of the GNU General Public License
00017  *      along with this program; if not, write to the Free Software
00018  *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 /*      mostly assembled from TIS ELF 1.1g and BFD-ELF  */
00022 
00023 #ifndef __PEFFSTRUC_H__
00024 #define __PEFFSTRUC_H__
00025 
00026 #include "global.h"
00027 
00028 enum PEF_ARCH {
00029         PEFARCH_PowerPC,
00030         PEFARCH_M68K
00031 };
00032 
00033 struct PEF_CONTAINER_HEADER {
00034         byte    tag1[4] HTPACKED;
00035         byte    tag2[4] HTPACKED;
00036         byte    architecture[4] HTPACKED;
00037         uint32  formatVersion HTPACKED; // normally 1
00038         uint32  dateTimeStamp HTPACKED; // number of seconds measured from January 1, 1904
00039         uint32  oldDefVersion HTPACKED;
00040         uint32  oldImpVersion HTPACKED;
00041         uint32  currentVersion HTPACKED;
00042         uint16  sectionCount HTPACKED;
00043         uint16  instSectionCount HTPACKED;
00044         uint32  reservedA HTPACKED;
00045 };
00046 
00047 struct PEF_SECTION_HEADER {
00048         sint32  nameOffset HTPACKED;    // 0xffffffff for no name
00049         uint32  defaultAddress HTPACKED;
00050         uint32  totalSize HTPACKED;
00051         uint32  unpackedSize HTPACKED;
00052         uint32  packedSize HTPACKED;
00053         uint32  containerOffset HTPACKED;
00054         byte    sectionKind HTPACKED;
00055         byte    shareKind HTPACKED;
00056         byte    alignment HTPACKED;
00057         byte    reservedA HTPACKED;
00058 };
00059 
00060 // sectionKind
00061 #define PEF_SK_Code             0       // R-x
00062 #define PEF_SK_UnpackedData     1       // RW-
00063 #define PEF_SK_PatternInitData  2       // RW-
00064 #define PEF_SK_ConstData        3       // R--
00065 #define PEF_SK_Loader           4
00066 #define PEF_SK_Debug            5
00067 #define PEF_SK_ExecutableData   6       // RWX
00068 #define PEF_SK_Exception        7
00069 #define PEF_SK_Traceback        8
00070 
00071 // shareKind
00072 #define PEF_SHK_ProcessShare    1
00073 #define PEF_SHK_GlobalShare     4
00074 #define PEF_SHK_ProtectedShare  5
00075 
00076 struct PEF_LOADER_INFO_HEADER {
00077         sint32  mainSection HTPACKED;          
00078         uint32  mainOffset HTPACKED;           
00079         sint32  initSection HTPACKED;          
00080         uint32  initOffset HTPACKED;           
00081         sint32  termSection HTPACKED;          
00082         uint32  termOffset HTPACKED;           
00083         uint32  importedLibraryCount HTPACKED;
00084         uint32  totalImportedSymbolCount HTPACKED;
00085         uint32  relocSectionCount HTPACKED;
00086         uint32  relocInstrOffset HTPACKED;
00087         uint32  loaderStringsOffset HTPACKED;
00088         uint32  exportHashOffset HTPACKED;
00089         uint32  exportHashTablePower HTPACKED;
00090         uint32  exportedSymbolCount HTPACKED;
00091 };
00092 
00093 struct PEFAddress {
00094         uint32 a32;
00095 };
00096 
00097 struct PEF_ImportedLibrary {
00098         uint32  nameOffset HTPACKED;
00099         uint32  oldImpVersion HTPACKED;
00100         uint32  currentVersion HTPACKED;
00101         uint32  importedSymbolCount HTPACKED;
00102         uint32  firstImportedSymbol HTPACKED;
00103         uint8   options HTPACKED;
00104         uint8   reservedA HTPACKED;
00105         uint16  reservedB HTPACKED;
00106 };
00107 
00108 #define PEF_CODE_SYMBOL         0       // code address
00109 #define PEF_DATA_SYMBOL         1       // data address
00110 #define PEF_TVECT_SYMBOL        2       // standard procedure pointer
00111 #define PEF_TOC_SYMBOL          3       // direct data area (table of contents) symbol
00112 #define PEF_GLUE_SYMBOL         4       // linker-inserted glue symbol
00113 
00114 struct PEF_LoaderRelocationHeader {
00115         uint16  sectionIndex;
00116         uint16  reservedA;
00117         uint32  relocCount;
00118         uint32  firstRelocOffset;
00119 };
00120 
00121 //#define       PEF_
00122 
00123 extern byte PEF_SECTION_HEADER_struct[];
00124 extern byte PEF_CONTAINER_HEADER_struct[];
00125 extern byte PEF_LOADER_INFO_HEADER_struct[];
00126 extern byte PEF_ImportedLibrary_struct[];
00127 
00128 #endif /* __PEFFSTRUC_H__ */

Generated on Fri May 7 21:15:42 2004 by doxygen 1.3.5