iPXE
coff.h
Go to the documentation of this file.
00001 #ifndef COFF_H
00002 #define COFF_H
00003 /* Based on the elf.h file
00004  * Changed accordingly to support COFF file support
00005  */
00006 
00007 
00008 /* Values for f_flags. */
00009 #define F_RELFLG        0x0001  /* If set, not reloc. info. Clear for executables */
00010 #define F_EXEC          0x0002  /* No unresolved symbols. Executable file ! */
00011 #define F_LNNO          0x0004  /* If set, line information numbers removed  */
00012 #define F_LSYMS         0x0008  /* If set, local symbols removed  */
00013 #define F_AR32WR        0x0100  /* Indicates little endian file */
00014 
00015 /* Values for e_machine (architecute). */
00016 #define EM_E1           0x17a   /* Magic number for Hyperstone. Big endian format */
00017 
00018 /* Values for f_flags. */
00019 #define O_MAGIC         0x017c  /* Optional's header magic number for Hyperstone */
00020 
00021 /* Values for s_flags. */
00022 #define S_TYPE_TEXT     0x0020  /* If set, the section contains only executable */
00023 #define S_TYPE_DATA     0x0040  /* If set, the section contains only initialized data */
00024 #define S_TYPE_BSS      0x0080  /* If set, the section is BSS no data stored */
00025 
00026 
00027 typedef struct
00028 {
00029         unsigned short  f_magic;        /* magic number                         */
00030         unsigned short  f_nscns;        /* number of sections           */
00031         unsigned long   f_timdat;       /* time & date stamp            */
00032         unsigned long   f_symptr;       /* file pointer to symtab       */
00033         unsigned long   f_nsyms;        /* number of symtab entries     */
00034         unsigned short  f_opthdr;       /* sizeof(optional hdr)         */
00035         unsigned short  f_flags;        /* flags                                        */
00036 }
00037 COFF_filehdr;
00038 
00039 /*
00040  * Optional header.
00041  */
00042 typedef struct 
00043 {
00044   unsigned short        magic;          /* type of file                         */
00045   unsigned short        vstamp;         /* version stamp                        */
00046   unsigned long         tsize;          /* text size in bytes, padded to FW bdry*/
00047   unsigned long         dsize;          /* initialized data "  "                */
00048   unsigned long         bsize;          /* uninitialized data "   "             */
00049   unsigned long         entry;          /* entry pt.                            */
00050   unsigned long         text_start;     /* base of text used for this file */
00051   unsigned long         data_start;     /* base of data used for this file */
00052 }       
00053 COFF_opthdr;
00054 
00055 /*
00056  * Section header.
00057  */
00058 typedef struct 
00059 {
00060         char                            s_name[8];      /* section name                 */
00061         unsigned long           s_paddr;        /* physical address, aliased s_nlib */
00062         unsigned long           s_vaddr;        /* virtual address              */
00063         unsigned long           s_size;         /* section size                 */
00064         unsigned long           s_scnptr;       /* file ptr to raw data for section */
00065         unsigned long           s_relptr;       /* file ptr to relocation       */
00066         unsigned long           s_lnnoptr;      /* file ptr to line numbers     */
00067         unsigned short          s_nreloc;       /* number of relocation entries */
00068         unsigned short          s_nlnno;        /* number of line number entries*/
00069         unsigned long           s_flags;        /* flags                        */
00070 }
00071 COFF_scnhdr;
00072 
00073 #endif /* COFF_H */