Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / arch / all-mingw32 / bootstrap / elfloader32.h
blob7084952cf32ba0d370ee3b03b8eab80cee372f76
1 #ifndef ELFLOADER_H_
2 #define ELFLOADER_H_
4 /*
5 Copyright (C) 2006 The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #define SHT_PROGBITS 1
10 #define SHT_SYMTAB 2
11 #define SHT_STRTAB 3
12 #define SHT_RELA 4
13 #define SHT_NOBITS 8
14 #define SHT_REL 9
16 #define ET_REL 1
17 #define EM_386 3
19 #define STT_OBJECT 1
20 #define STT_FUNC 2
22 #define SHN_ABS 0xfff1
23 #define SHN_COMMON 0xfff2
24 #define SHN_UNDEF 0
26 #define SHF_WRITE (1 << 0)
27 #define SHF_ALLOC (1 << 1)
28 #define SHF_EXECINSTR (1 << 2)
30 #define R_386_NONE 0
31 #define R_386_32 1
32 #define R_386_PC32 2
34 #define ELF64_ST_TYPE(i) ((i) & 0x0F)
36 #define ELF32_R_SYM(val) ((val) >> 8)
37 #define ELF32_R_TYPE(val) ((val) & 0xff)
38 #define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
40 struct elfheader
42 unsigned char ident[16];
43 unsigned short type;
44 unsigned short machine;
45 unsigned int version;
46 void* entry;
47 unsigned int phoff;
48 unsigned int shoff;
49 unsigned int flags;
50 unsigned short ehsize;
51 unsigned short phentsize;
52 unsigned short phnum;
53 unsigned short shentsize;
54 unsigned short shnum;
55 unsigned short shstrndx;
57 /* these are internal, and not part of the header proper. they are wider
58 * versions of shnum and shstrndx for when they don't fit in the header
59 * and we need to get them from the first section header. see
60 * load_header() for details
62 unsigned int int_shnum;
63 unsigned int int_shstrndx;
66 struct sheader
68 unsigned int name;
69 unsigned int type;
70 unsigned int flags;
71 void* addr;
72 unsigned int offset;
73 unsigned int size;
74 unsigned int link;
75 unsigned int info;
76 unsigned int addralign;
77 unsigned int entsize;
80 struct symbol
82 unsigned int name; /* Offset of the name string in the string table */
83 unsigned int value; /* Varies; eg. the offset of the symbol in its hunk */
84 unsigned int size; /* How much memory does the symbol occupy */
85 unsigned char info; /* What kind of symbol is this ? (global, variable, etc) */
86 unsigned char other; /* undefined */
87 unsigned short shindex; /* In which section is the symbol defined ? */
91 struct relo
93 unsigned int offset; /* Address of the relocation relative to the section it refers to */
94 unsigned int info; /* Type of the relocation */
97 int load_elf_file(void *, ULONG_PTR);
98 void *kernel_lowest();
99 void *kernel_highest();
100 void set_base_address(void *tracker, void ** sysbaseaddr);
102 #endif /*ELFLOADER_H_*/