49 #define PT_EH_FRAME 0x6474E550
52 #define PT_GNU_STACK 0x6474E551
57 #define PT_GNU_RELRO 0x6474E552
59 #define PT_LOPROC 0x70000000
61 #define PT_HIPROC 0x7FFFFFFF
199 #define ELFDATA2LSB 1
232 #define ELF32_ST_BIND(INFO) ((INFO) >> 4)
234 #define ELF32_ST_TYPE(INFO) ((INFO)&0x0F)
int elf_check_magic_number(elf_header_t *hdr)
Checks the correctness of the ELF header magic number.
Definition: elf.c:398
struct elf_section_header elf_section_header_t
A section header with all kinds of useful information.
int elf_check_file_header(elf_header_t *hdr)
Checks the correctness of the ELF header.
Definition: elf.c:369
const char * elf_type_to_string(int type)
Transforms the passed ELF type to string.
Definition: elf.c:422
Elf_Ident
Fields index of ELF_IDENT.
Definition: elf.h:181
@ EI_ABIVERSION
OS Specific.
Definition: elf.h:190
@ EI_MAG1
'E'
Definition: elf.h:183
@ EI_DATA
Set to either 1 or 2 to signify little or big endianness.
Definition: elf.h:187
@ EI_MAG0
0x7F
Definition: elf.h:182
@ EI_PAD
Padding.
Definition: elf.h:191
@ EI_MAG3
'F'
Definition: elf.h:185
@ EI_CLASS
Architecture (32/64)
Definition: elf.h:186
@ EI_OSABI
OS Specific.
Definition: elf.h:189
@ EI_VERSION
ELF Version.
Definition: elf.h:188
@ EI_MAG2
'L'
Definition: elf.h:184
struct elf_symbol elf_symbol_t
A symbol itself.
int elf_check_file_type(vfs_file_t *file, Elf_Type type)
Checks if the file is a valid ELF.
Definition: elf.c:345
ShT_Attributes
ShT_Attributes corresponds to the field sh_flags, but are bit flags rather than stand-alone values.
Definition: elf.h:226
@ SHF_ALLOC
Exists in memory.
Definition: elf.h:228
@ SHF_WRITE
Writable section.
Definition: elf.h:227
const char * elf_section_header_type_to_string(int type)
Transforms the passed ELF section header type to string.
Definition: elf.c:438
struct elf_rel_t elf_rel_t
Holds information about relocation object (that do not need an addend).
struct elf_rela_t elf_rela_t
Holds information about relocation object (that need an addend).
StT_Bindings
Provides possible symbol bindings.
Definition: elf.h:237
@ STB_GLOBAL
Global scope.
Definition: elf.h:239
@ STB_LOCAL
Local scope.
Definition: elf.h:238
@ STB_WEAK
Weak, (ie. attribute((weak)))
Definition: elf.h:240
const char * elf_symbol_type_to_string(int type)
Transforms the passed ELF symbol type to string.
Definition: elf.c:449
struct elf_program_header elf_program_header_t
The elf program header, holding program layout information.
struct elf_header elf_header_t
The elf starting section.
int elf_load_file(task_struct *task, vfs_file_t *file, uint32_t *entry)
Loads an ELF file into the memory of task.
Definition: elf.c:287
ShT_Types
Defines a number of different types of sections, which correspond to values stored in the field sh_ty...
Definition: elf.h:214
@ SHT_RELA
Relocation (w/ addend)
Definition: elf.h:219
@ SHT_PROGBITS
Program information.
Definition: elf.h:216
@ SHT_STRTAB
String table.
Definition: elf.h:218
@ SHT_REL
Relocation (no addend)
Definition: elf.h:221
@ SHT_SYMTAB
Symbol table.
Definition: elf.h:217
@ SHT_NOBITS
Not present in file.
Definition: elf.h:220
@ SHT_NULL
Null section.
Definition: elf.h:215
#define EI_NIDENT
Elf header ident size.
Definition: elf.h:66
Elf_Type
Type of ELF files.
Definition: elf.h:203
@ ET_NONE
Unkown Type.
Definition: elf.h:204
@ ET_REL
Relocatable File.
Definition: elf.h:205
@ ET_EXEC
Executable File.
Definition: elf.h:206
const char * elf_symbol_bind_to_string(int bind)
Transforms the passed ELF symbol bind to string.
Definition: elf.c:457
StT_Types
Provides a number of possible symbol types.
Definition: elf.h:244
@ STT_FUNC
Methods or functions.
Definition: elf.h:247
@ STT_NOTYPE
No type.
Definition: elf.h:245
@ STT_OBJECT
Variables, arrays, etc.
Definition: elf.h:246
Process data structures and functions.
Standard integer data-types.
unsigned short uint16_t
Define the unsigned 16-bit integer.
Definition: stdint.h:24
int int32_t
Define the signed 32-bit integer.
Definition: stdint.h:15
unsigned int uint32_t
Define the unsigned 32-bit integer.
Definition: stdint.h:18
unsigned char uint8_t
Define the unsigned 8-bit integer.
Definition: stdint.h:30
Holds information about relocation object (that do not need an addend).
Definition: elf.h:163
uint32_t r_info
TODO: Comment.
Definition: elf.h:167
uint32_t r_offset
TODO: Comment.
Definition: elf.h:165
Holds information about relocation object (that need an addend).
Definition: elf.h:171
int32_t r_addend
TODO: Comment.
Definition: elf.h:177
uint32_t r_offset
TODO: Comment.
Definition: elf.h:173
uint32_t r_info
TODO: Comment.
Definition: elf.h:175
A symbol itself.
Definition: elf.h:147
uint8_t info
TODO: Comment.
Definition: elf.h:155
uint8_t other
TODO: Comment.
Definition: elf.h:157
uint32_t name
TODO: Comment.
Definition: elf.h:149
uint32_t value
TODO: Comment.
Definition: elf.h:151
uint16_t ndx
TODO: Comment.
Definition: elf.h:159
uint32_t size
TODO: Comment.
Definition: elf.h:153
this is our task object. Every process in the system has this, and it holds a lot of information....
Definition: process.h:82
Data structure that contains information about the mounted filesystems.
Definition: vfs_types.h:112