Changeset 2496 for trunk/src


Ignore:
Timestamp:
Jan 22, 2000, 1:47:59 AM (26 years ago)
Author:
bird
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/include/elf.h

    r1678 r2496  
    1 /* $Id: elf.h,v 1.2 1999-11-10 01:45:32 bird Exp $
     1/* $Id: elf.h,v 1.3 2000-01-22 00:47:59 bird Exp $
    22 *
    33 * ELF stuff.
     
    1313#define _elf_h_
    1414
    15 #define ELFMAG0     0x7f
    16 #define ELFMAG1     'E'
    17 #define ELFMAG2     'L'
    18 #define ELFMAG3     'F'
    19 
    20 #endif //_elf_h_
     15//#pragma pack(1)
     16
     17/*
     18 * Basic ELF types.
     19 */
     20typedef unsigned long   Elf32_Addr;   /* Unsigned program address. */
     21typedef unsigned short  Elf32_Half;   /* Unsigned medium integer.  */
     22typedef signed long     Elf32_Off;    /* Unsigned file offset.     */
     23typedef signed long     Elf32_Sword;  /* Signed large interger.    */
     24typedef unsigned long   Elf32_Word;   /* Unsigned large integer.   */
     25/*                      unsigned char    Unsigned small integer.   */
     26
     27
     28
     29/*
     30 * ELF Header
     31 */
     32#define EI_INDENT         0x10
     33
     34typedef struct                          /* 0x34 */
     35{
     36    unsigned char   e_ident[EI_INDENT]; /* 0x00  ELF Indentification */
     37    Elf32_Half      e_type;             /* 0x10  Object file type */
     38    Elf32_Half      e_machine;          /* 0x12  Machine type */
     39    Elf32_Word      e_version;          /* 0x14  ELF format version */
     40    Elf32_Addr      e_entry;            /* 0x18  Entry point address */
     41    Elf32_Off       e_phoff;            /* 0x1c  File offset of the program header table */
     42    Elf32_Off       e_shoff;            /* 0x20  File offset of the section header table */
     43    Elf32_Word      e_flags;            /* 0x24  Processor specific flags */
     44    Elf32_Half      e_ehsize;           /* 0x28  Size of the Elf Header (this structure) */
     45    Elf32_Half      e_phentsize;        /* 0x2a  Size of one entry in the program header table */
     46    Elf32_Half      e_phnum;            /* 0x2c  Number of entries in the program header table */
     47    Elf32_Half      e_shentsize;        /* 0x2e  Size of one entry in the section header table */
     48    Elf32_Half      e_shnum;            /* 0x30  Number of entries in the section header table */
     49    Elf32_Half      e_shstrndx;         /* 0x32  Section header table index of the string table */
     50} Elf32_Ehdr;
     51
     52/* e_idnet - ELF Identification */
     53#define EI_MAG0         0               /* File identificator */
     54#define EI_MAG1         1               /* File identificator */
     55#define EI_MAG2         2               /* File identificator */
     56#define EI_MAG3         3               /* File identificator */
     57#define EI_CLASS        4               /* File class */
     58#define EI_DATA         5               /* Data encoding */
     59#define EI_VERSION      6               /* File version */
     60#define EI_PAD          7               /* Start of padding bytes */
     61    /* EI_MAG[0-4] */
     62#define ELFMAG0         0x7f
     63#define ELFMAG1         'E'
     64#define ELFMAG2         'L'
     65#define ELFMAG3         'F'
     66#define ELFMAGICLSB     ( 0x7f        | ('E' <<  8) | ('L' << 16) | ('F' << 24))
     67#define ELFMAGICMSB     ((0x7f << 24) | ('E' << 16) | ('L' <<  8) |  'F'       )
     68    /* EI_CLASS */
     69#define ELFCLASSNONE    0               /* Invalid class */
     70#define ELFCLASS32      1               /* 32-bit objects */
     71#define ELFCLASS64      2               /* 64-bit objects */
     72#define ELFCLASSNUM     3               /* ? */
     73    /* EI_DATA */
     74#define ELFDATANONE     0               /* Invalid data encoding */
     75#define ELFDATA2LSB     1               /* Little endian encoding */
     76#define ELFDATA2MSB     2               /* Big endian encoding */
     77
     78/* e_type contents */
     79#define ET_NONE         0x0000          /* No file type */
     80#define ET_REL          0x0001          /* Relocatable file */
     81#define ET_EXEC         0x0002          /* Executable file */
     82#define ET_DYN          0x0003          /* Shared object file */
     83#define ET_CORE         0x0004          /* Core file */
     84#define ET_LOPROC       0xff00          /* Processor-specific - currect value? */
     85#define ET_HIPROC       0xffff          /* Processor-specific - currect value? */
     86
     87/* e_machine contents */
     88#define EM_NONE         0               /* No machine */
     89#define EM_M32          1               /* AT&T WE 32100 */
     90#define EM_SPARC        2               /* SPARC */
     91#define EM_386          3               /* Intel 80386 */
     92#define EM_68K          4               /* Motorola 680000 */
     93#define EM_88K          5               /* Motorola 880000 */
     94#define EM_486          6               /* Intel 80486 - disused? */
     95#define EM_860          7               /* Intel 80860 */
     96#define EM_MIPS         8               /* MIPS RS3000 (big endian...) */
     97#define EM_MIPS_RS4_BE  10              /* MIPS RS4000 (big endian) */
     98#define EM_SPARC64      11              /* SPARC v9 (not official) 64-bit */
     99#define EM_PARISC       15              /* HPPA */
     100#define EM_SPARC32PLUS  18              /* SUN's "v8plus" */
     101#define EM_PPC          20              /* PowerPC */
     102#define EM_ALPHA        0x9026          /* Digital Alpha - NB! Interim number */
     103
     104/* e_version contents */
     105#define EV_NONE         0               /* Invalid version */
     106#define EV_CURRENT      1               /* Current version */
     107#define EV_NUM          2               /* ? */
     108
     109/* e_flags - Machine Information */
     110#define EF_386_NONE     0               /* Intel 80386 has no flags defined */
     111#define EF_486_NONE     0               /* Intel 80486 has no flags defined */
     112
     113
     114/*
     115 * ELF Sections
     116 */
     117typedef struct                          /* 0x28 */
     118{
     119    Elf32_Word      sh_name;            /* 0x00  Section name. Index into the section header string table section. */
     120    Elf32_Word      sh_type;            /* 0x04  Section type. Categorizes the contents and semantics. */
     121    Elf32_Word      sh_flags;           /* 0x08  Section flags. */
     122    Elf32_Addr      sh_addr;            /* 0x0c  Address to where in memory the section should reside.  */
     123    Elf32_Off       sh_offset;          /* 0x10  Offset into the file of the section's data. */
     124    Elf32_Word      sh_size;            /* 0x14  Section's size in bytes. */
     125    Elf32_Word      sh_link;            /* 0x18  Section header table index link. */
     126    Elf32_Word      sh_info;            /* 0x1c  Extra information. */
     127    Elf32_Word      sh_addralign;       /* 0x20  Section alignment. */
     128    Elf32_Word      sh_entsize;         /* 0x24  Entry size of some evtentual fixed-sized table entries. */
     129} Elf32_Shdr;
     130
     131/* section indexes (section references) */
     132#define SHN_UNDEF       0               /* Undefined/missing/irrelevant/meaningless section reference. */
     133#define SHN_LORESERVE   0xff00          /* Lower bound of the reserved indexes. */
     134#define SHN_LOPROC      0xff00          /* Processor-specific semantics lower bound. */
     135#define SHN_HIPROC      0xff1f          /* Processor-specific semantics upper bound. */
     136#define SHN_ABS         0xfff1          /* Absolute values for the corresponding reference. */
     137#define SHN_COMMON      0xfff2          /* Symbols defined relative to this section are common symbols. */
     138#define SHN_HIRESERVE   0xffff          /* Upper bound of the reserved indexes. */
     139
     140/* sh_type */
     141#define SHT_NULL        0               /* Inactive section header. All other members have undefined contents. */
     142#define SHT_PROGBITS    1               /* Program defined information. */
     143#define SHT_SYMTAB      2               /* Symboltable. */
     144#define SHT_STRTAB      3               /* Stringtable. */
     145#define SHT_RELA        4               /* Relocations with explicit addends. */
     146#define SHT_HASH        5               /* Symbol has table. */
     147#define SHT_DYNAMIC     6               /* Dynamic linking information. */
     148#define SHT_NOTE        7               /* Information tat marks the file in some way. */
     149#define SHT_NOBITS      8               /* Occupies no space in the file. */
     150#define SHT_REL         9               /* Relocations. */
     151#define SHT_SHLIB       10              /* reserved. */
     152#define SHT_DYNSYM      11              /* Symboltable used for dynamic loading. */
     153#define SHT_NUM         12              /* ? */
     154#define SHT_LOPROC      0x70000000L     /* Processor-spcific semantics lower bound. */
     155#define SHT_HIPROC      0x7fffffffL     /* Processor-spcific semantics upper bound. */
     156#define SHT_LOUSER      0x80000000L     /* Application program specific lower bound. */
     157#define SHT_HIUSER      0xffffffffL     /* Application program specific upper bound. */
     158
     159/* sh_flags */
     160#define  SHF_WRITE      0x1             /* Writable during process execution. */
     161#define  SHF_ALLOC      0x2             /* The section occupies memory during process execution. */
     162#define  SHF_EXECINSTR  0x4             /* Executable machine instructs. */
     163#define  SHF_MASKPROC   0xf0000000L     /* Processor-specific semantics bits. */
     164
     165
     166/*
     167 * ELF Symbol table
     168 */
     169typedef struct                          /* 0x10 */
     170{
     171    Elf32_Word      st_name;            /* 0x00  Symbol name. (index) */
     172    Elf32_Addr      st_value;           /* 0x04  Value associated with the symbol. */
     173    Elf32_Word      st_size;            /* 0x08  Size associated with the symbol. */
     174    unsigned char   st_info;            /* 0x0c  Symbol type and binding attributes. */
     175    unsigned char   st_other;           /* 0x0d  Reserved. (currently 0?) */
     176    Elf32_Half      st_shndx;           /* 0x0e  Section index of related section. */
     177} Elf32_Sym;
     178
     179/* symbol table index(es) */
     180#define STN_UNDEF       0               /* Reserved symboltable entry. */
     181
     182/* st_info macros */
     183#define ELF32_ST_BIND(i)    ((i) >> 4)  /* Get the symbol binding attributes from the st_info member. */
     184#define ELF32_ST_TYPE(i)    ((i) & 0x0f)/* Get the symbol type from the st_info member. */
     185#define ELF32_ST_INFO(b,t)  ((b << 4) | (t & 0x0f)) /* Build a st_info member. */
     186
     187/* st_info - binding attributes */
     188#define STB_LOCAL       0x0             /* Local symbol. Not visible outside the object file. */
     189#define STB_GLOBAL      0x1             /* Global symbol. Visible to everyone. */
     190#define STB_WEAK        0x2             /* Weak symbols resemble global symbols, but their definitions have lower precedence. */
     191#define STB_LOPROC      0xd             /* Processor-specific semantics lower bound. */
     192#define STB_HIPROC      0xf             /* Processor-specific semantics upper bound. */
     193
     194/* st_info - types */
     195#define STT_NOTYPE      0x0             /* The symbol's type is not defined. */
     196#define STT_OBJECT      0x1             /* The symbol is associated with a data object, such as a variable an array, etc. */
     197#define STT_FUNC        0x2             /* The symbol is associated with a function or other executable code. */
     198#define STT_SECTION     0x3             /* The symbol is associated with a section. */
     199#define STT_FILE        0x4             /* Name of the source file... */
     200#define STT_LOPROC      0xd             /* Processor-specific semantics lower bound. */
     201#define STT_HIPROC      0xf             /* Processor-specific semantics upper bound. */
     202
     203
     204/*
     205 * ELF Relocation
     206 */
     207typedef struct                          /* 0x08 */
     208{
     209    Elf32_Addr      r_offset;           /* 0x00  Offset or virtual address. */
     210    Elf32_Word      r_info;             /* 0x04  Symbolindex/type. */
     211} Elf32_Rel;
     212
     213typedef struct                          /* 0x0c */
     214{
     215    Elf32_Addr      r_offset;           /* 0x00  Offset or virtual address. */
     216    Elf32_Word      r_info;             /* 0x04  Symbolindex/type. */
     217    Elf32_Sword     r_addend;           /* 0x08  Constant addend. */
     218} Elf32_Rela;
     219
     220/* r_info macro */
     221#define ELF32_R_SYM(i)      ((i) >> 8)  /* Gets symbol index from the r_info member. */
     222#define ELF32_R_TYPE(i)     ((unsigned char)(i)) /* Get the relocation type from the r_info member. */
     223#define ELF32_R_INFO(s,t)   (((s) << 8) | (unsigned char)(t)) /* Makes the r_info member. */
     224
     225/* r_info - Intel 80386 relocations */
     226#define R_386_NONE      0               /*  */
     227#define R_386_32        1
     228#define R_386_PC32      2
     229#define R_386_GOT32     3
     230#define R_386_PLT32     4
     231#define R_386_COPY      5
     232#define R_386_GLOB_DAT  6
     233#define R_386_JMP_SLOT  7
     234#define R_386_RELATIVE  8
     235#define R_386_GOT_OFF   9
     236#define R_386_GOTPC     10
     237#define R_386_NUM       11
     238
     239//#pragma pack()
     240#endif /*_elf_h_*/
Note: See TracChangeset for help on using the changeset viewer.