|
Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
|
Go to the source code of this file.
Data Structures | |
| struct | Elf64_Ehdr |
| struct | Elf64_Phdr |
| struct | Elf64_Shdr |
| struct | Elf64_Sym |
| struct | Elf64_Rel |
| struct | Elf64_Rela |
| struct | Elf64_Dyn |
| struct | vector_uint64_t |
| struct | elf_dynamic_map |
| struct | elf_section_map |
| struct | GnuHashHeader |
| struct | elf_load_mmap_table |
| struct | tcb |
Macros | |
| #define | EI_MAG0 0 |
| #define | ELFMAG0 0x7f |
| #define | EI_MAG1 1 |
| #define | ELFMAG1 'E' |
| #define | EI_MAG2 2 |
| #define | ELFMAG2 'L' |
| #define | EI_MAG3 3 |
| #define | ELFMAG3 'F' |
| #define | ELFMAG "\177ELF" |
| #define | PF_X 0x1 |
| #define | PF_W 0x2 |
| #define | PF_R 0x4 |
| #define | ELF64_R_SYM(i) |
| #define | ELF64_R_TYPE(i) |
| #define | ELF64_R_INFO(s, t) |
| #define | ELF_PTR(type, base, off) |
Typedefs | |
| typedef struct Elf64_Ehdr | Elf64_Ehdr |
| typedef struct Elf64_Phdr | Elf64_Phdr |
| typedef struct Elf64_Shdr | Elf64_Shdr |
| typedef struct Elf64_Sym | Elf64_Sym |
| typedef struct Elf64_Rel | Elf64_Rel |
| typedef struct Elf64_Rela | Elf64_Rela |
| typedef struct Elf64_Dyn | Elf64_Dyn |
| typedef void(* | ctor_t) (void) |
Variables | |
| elf_section_map * | map |
| elf_section_map uintptr_t | base |
| #define ELF64_R_INFO | ( | s, | |
| t ) |
| #define ELF64_R_SYM | ( | i | ) |
| #define ELF64_R_TYPE | ( | i | ) |
Definition at line 346 of file elf.h.
Referenced by elf_count_load_size(), elf_dyn_map_all(), elf_load(), and execve().
| #define PF_R 0x4 |
Definition at line 260 of file elf.h.
Referenced by elf_pflags_to_page_flags().
| #define PF_W 0x2 |
Definition at line 259 of file elf.h.
Referenced by elf_pflags_to_page_flags().
| #define PF_X 0x1 |
Definition at line 258 of file elf.h.
Referenced by elf_pflags_to_page_flags().
| typedef struct Elf64_Dyn Elf64_Dyn |
| typedef struct Elf64_Ehdr Elf64_Ehdr |
| typedef struct Elf64_Phdr Elf64_Phdr |
| typedef struct Elf64_Rel Elf64_Rel |
| typedef struct Elf64_Rela Elf64_Rela |
| typedef struct Elf64_Shdr Elf64_Shdr |
| typedef struct Elf64_Sym Elf64_Sym |
| enum Elf4_E_Type |
| enum Elf64_RelType |
| enum Elf_Dtag |
| enum Elf_Shdr_Flags |
| enum Elf_Shtag |
| __attribute__ | ( | (deprecated("This function is deprecated and may be " "removed in future versions.")) | ) | volatile |
References DEPRECATED.
| void elf_call_init_array | ( | elf_section_map * | map, |
| uintptr_t | base ) |
Definition at line 680 of file elf.c.
References base, count, LOG2_DEBUG, LOG2_INFO, map, Elf64_Shdr::sh_addr, and Elf64_Shdr::sh_size.
Referenced by proccess_elf().
| void elf_call_init_array_with_table | ( | elf_section_map * | map, |
| struct elf_load_mmap_table * | table, | ||
| int | table_count ) |
Definition at line 699 of file elf.c.
References count, elf_roffset_to_kernel_ptr(), map, serial2_printf(), and table.
Definition at line 629 of file elf.c.
References ALIGN_UP, ASSUME_ALIGNED, BLOCK_SIZE, data, Elf64_Ehdr::e_phentsize, Elf64_Ehdr::e_phnum, Elf64_Ehdr::e_phoff, Elf64_Ehdr::e_version, ELF_PTR, LOG2_INFO, max(), Elf64_Phdr::p_memsz, Elf64_Phdr::p_type, Elf64_Phdr::p_vaddr, and PT_LOAD.
Referenced by execve(), and proccess_elf().
| void elf_dyn_map_all | ( | Elf64_Dyn * | dyn, |
| uint8_t * | data, | ||
| elf_dynamic_map * | map ) |
Definition at line 60 of file elf.c.
References ASSUME_ALIGNED, Elf64_Dyn::d_ptr, Elf64_Dyn::d_tag, Elf64_Dyn::d_un, Elf64_Dyn::d_val, data, DT_HASH, DT_JMPREL, DT_NEEDED, DT_NULL, DT_PLTGOT, DT_PLTRELSZ, DT_RELA, DT_RELAENT, DT_RELASZ, DT_STRTAB, DT_SYMTAB, Elf64_Ehdr::e_phnum, Elf64_Ehdr::e_phoff, ELF_PTR, hash, LOG2_INFO, map, offset, Elf64_Phdr::p_memsz, Elf64_Phdr::p_offset, Elf64_Phdr::p_vaddr, PTR_ADD, vaddr_to_file_offset(), vector_init, and vector_push_back.
Referenced by execve(), and proccess_elf().
Definition at line 17 of file elf.c.
References ASSUME_ALIGNED, data, Elf64_Ehdr::e_phentsize, Elf64_Ehdr::e_phnum, Elf64_Ehdr::e_phoff, Elf64_Phdr::p_offset, Elf64_Phdr::p_type, Elf64_Phdr::p_vaddr, PT_LOAD, and PTR_ADD.
| uintptr_t elf_find_symbol | ( | const char * | name, |
| GnuHashHeader * | gnuhash, | ||
| uintptr_t | base, | ||
| elf_section_map * | map, | ||
| uint8_t * | data ) |
Definition at line 730 of file elf.c.
References base, data, elf_gnu_lookup(), LOG2_INFO, LOG2_WARN, map, name, name_len, Elf64_Sym::st_name, Elf64_Sym::st_value, strlen(), and strncmp().
Referenced by proccess_elf().
Definition at line 255 of file elf.c.
References ASSUME_ALIGNED, base, data, and Elf64_Ehdr::e_entry.
Definition at line 45 of file elf.c.
References ASSUME_ALIGNED, data, Elf64_Ehdr::e_phentsize, Elf64_Ehdr::e_phnum, Elf64_Ehdr::e_phoff, NULL, Elf64_Phdr::p_offset, Elf64_Phdr::p_type, PT_DYNAMIC, and PTR_ADD.
Referenced by execve(), and proccess_elf().
| void elf_get_symbol | ( | const char * | sym_name, |
| uintptr_t | base, | ||
| elf_section_map * | map, | ||
| uint8_t * | data, | ||
| symbols_ptr_vector_t * | syms, | ||
| boolean_t | skip_empty_val ) |
Definition at line 653 of file elf.c.
References base, data, symbols::items, kalloc(), map, symbols::name, symbols_item::name, Elf64_Sym::st_name, Elf64_Sym::st_value, symbols_item::value, vector_init, and vector_push_back.
| void elf_gnu_hash_parse | ( | GnuHashHeader * | gnu_hash, |
| Elf64_Shdr * | gnu_hash_sym, | ||
| uint8_t * | data ) |
Definition at line 604 of file elf.c.
References ASSUME_ALIGNED, GnuHashHeader::bloom, GnuHashHeader::bloom_shift, GnuHashHeader::bloom_size, GnuHashHeader::buckets, GnuHashHeader::chains, data, memcopy(), memset(), GnuHashHeader::nbuckets, ptr, Elf64_Shdr::sh_offset, and GnuHashHeader::symoffset.
Referenced by execve(), and proccess_elf().
| Elf64_Sym * elf_gnu_lookup | ( | const char * | name, |
| GnuHashHeader * | gh, | ||
| Elf64_Sym * | symtab, | ||
| const char * | strtab ) |
Definition at line 578 of file elf.c.
References GnuHashHeader::buckets, GnuHashHeader::chains, elf_gnu_hash(), elf_gnu_maybe_present(), hash, idx, name, name_len, GnuHashHeader::nbuckets, NULL, Elf64_Sym::st_name, strlen(), strncmp(), and GnuHashHeader::symoffset.
Referenced by elf_find_symbol(), and elf_relocate_rel().
| size_t elf_load | ( | volatile uintptr_t * | page, |
| uint8_t * | data, | ||
| uintptr_t | temporary_base, | ||
| uintptr_t | base, | ||
| struct elf_load_mmap_table * | table ) |
Definition at line 261 of file elf.c.
References ALIGN_DOWN, ASSUME_ALIGNED, base, BLOCK_SIZE, data, Elf64_Ehdr::e_entry, Elf64_Ehdr::e_phentsize, Elf64_Ehdr::e_phnum, Elf64_Ehdr::e_phoff, Elf64_Ehdr::e_version, elf_pflags_to_page_flags(), ELF_PTR, get_kernel_vmm_page(), LOG2_INFO, max(), memcopy(), memset(), Elf64_Phdr::p_filesz, Elf64_Phdr::p_flags, Elf64_Phdr::p_memsz, Elf64_Phdr::p_offset, Elf64_Phdr::p_type, Elf64_Phdr::p_vaddr, page, paging_get_highest_page_map(), phys_base_alloc(), PT_LOAD, table, vma_lookup_free_vaddr(), VMA_REGION_B, and vxMultipleMmap().
Referenced by execve(), and proccess_elf().
Definition at line 216 of file elf.c.
References flags, PAGE_NO_EXECUTE, PAGE_PRESENT, PAGE_USER, PAGE_WRITABLE, PF_R, PF_W, and PF_X.
Referenced by elf_load().
| void elf_relocate_dyn | ( | elf_dynamic_map * | map, |
| uintptr_t | kernel_base, | ||
| uintptr_t | user_base, | ||
| GnuHashHeader * | gnu_hash, | ||
| symbols_ptr_vector_t * | external_syms, | ||
| struct elf_load_mmap_table * | table, | ||
| int | table_count ) |
Definition at line 534 of file elf.c.
References count, elf_relocate_rel(), LOG2_INFO, map, serial2_printf(), and table.
Referenced by execve(), and proccess_elf().
| void elf_section_map_all | ( | uint8_t * | data, |
| elf_section_map * | map ) |
Definition at line 160 of file elf.c.
References ASSUME_ALIGNED, data, Elf64_Ehdr::e_shnum, Elf64_Ehdr::e_shoff, Elf64_Ehdr::e_shstrndx, LOG2_INFO, map, Elf64_Shdr::sh_addr, Elf64_Shdr::sh_name, Elf64_Shdr::sh_offset, Elf64_Shdr::sh_size, Elf64_Shdr::sh_type, SHT_FINI_ARRAY, SHT_GNU_HASH, SHT_INIT_ARRAY, SHT_PROGBITS, SHT_RELA, SHT_STRTAB, SHT_SYMTAB, and strncmp().
Referenced by execve(), INIT(), and proccess_elf().
| elf_section_map uintptr_t base |
Definition at line 296 of file elf.h.
Referenced by __attribute__(), __attribute__(), ecam_read32(), ecam_write32(), elf_call_init_array(), elf_find_symbol(), elf_get_entry(), elf_get_symbol(), elf_load(), elf_mmap_got(), gdt_make_entry(), iso9660_lookup(), itoa(), legacy_read32(), legacy_write32(), msrSetFSBase(), msrSetGSBase(), msrSetKernelGSBase(), pci_write8(), pow(), serial2_send_number(), serial2_send_unsigned_number(), serial_send_number(), serial_send_padded(), val_to_str(), and VirtioGpu::virtq_init().
| elf_section_map* map |
Definition at line 295 of file elf.h.
Referenced by elf_call_init_array(), elf_call_init_array_with_table(), elf_dyn_find(), elf_dyn_map_all(), elf_find_symbol(), elf_get_symbol(), elf_mmap_got(), elf_relocate_dyn(), and elf_section_map_all().