|
PatchworkOS
|
#include "kernel.h"#include <boot/boot_info.h>#include <stdint.h>#include <sys/elf.h>#include <sys/math.h>#include <sys/proc.h>Go to the source code of this file.
Functions | |
| static BOOLEAN | is_valid_phdr (const elf_phdr_t *phdr, uint64_t fileSize) |
| static BOOLEAN | is_valid_shdr (const elf_shdr_t *shdr, uint64_t fileSize) |
| static EFI_STATUS | determine_kernel_bounds (const elf_phdr_t *phdrs, const elf_hdr_t *header, uint64_t phdrTableSize, uintptr_t *virtStart, uintptr_t *virtEnd) |
| static EFI_STATUS | load_section_headers (EFI_FILE *file, boot_kernel_t *kernel, uint64_t fileSize) |
| static elf_shdr_t * | find_section_by_type (boot_kernel_t *kernel, elf_shdr_type_t sectionType) |
| static EFI_STATUS | load_symbol_table (EFI_FILE *file, boot_kernel_t *kernel, uint64_t fileSize) |
| static EFI_STATUS | load_kernel_segments (EFI_FILE *file, uintptr_t physStart, uintptr_t virtStart, uint64_t kernelPageAmount, const elf_phdr_t *phdrs, const elf_hdr_t *header, uint64_t fileSize) |
| EFI_STATUS | kernel_load (boot_kernel_t *kernel, EFI_FILE *rootHandle) |
|
static |
Definition at line 42 of file kernel.c.
References ELF_PHDR_TYPE_LOAD, MAX, elf_phdr_t::memorySize, MIN, NULL, elf_hdr_t::phdrAmount, elf_hdr_t::phdrSize, elf_phdr_t::type, UINT64_MAX, and elf_phdr_t::virtAddr.
Referenced by kernel_load().
|
static |
Definition at line 126 of file kernel.c.
References boot_kernel_t::header, NULL, boot_kernel_t::shdrCount, boot_kernel_t::shdrs, elf_hdr_t::shdrSize, and elf_shdr_t::type.
Referenced by load_symbol_table().
|
static |
Definition at line 9 of file kernel.c.
References elf_phdr_t::fileSize, NULL, and elf_phdr_t::offset.
Referenced by load_kernel_segments().
|
static |
Definition at line 24 of file kernel.c.
References ELF_SHDR_TYPE_NOBITS, NULL, elf_shdr_t::offset, elf_shdr_t::size, and elf_shdr_t::type.
Referenced by load_symbol_table().
| EFI_STATUS kernel_load | ( | boot_kernel_t * | kernel, |
| EFI_FILE * | rootHandle | ||
| ) |
Definition at line 298 of file kernel.c.
References BYTES_TO_PAGES, determine_kernel_bounds(), ELF_IS_VALID, boot_kernel_t::entry, elf_hdr_t::entry, file, boot_kernel_t::header, load_kernel_segments(), load_section_headers(), load_symbol_table(), NULL, elf_hdr_t::phdrAmount, elf_hdr_t::phdrOffset, boot_kernel_t::phdrs, elf_hdr_t::phdrSize, boot_kernel_t::physStart, boot_kernel_t::shdrs, boot_kernel_t::size, boot_kernel_t::stringTable, boot_kernel_t::symbolCount, boot_kernel_t::symbols, and boot_kernel_t::virtStart.
Referenced by boot_info_populate().
|
static |
Definition at line 251 of file kernel.c.
References ELF_PHDR_TYPE_LOAD, file, elf_phdr_t::fileSize, is_valid_phdr(), elf_phdr_t::memorySize, NULL, elf_phdr_t::offset, PAGE_SIZE, elf_hdr_t::phdrAmount, elf_hdr_t::phdrSize, elf_phdr_t::type, and elf_phdr_t::virtAddr.
Referenced by kernel_load().
|
static |
Definition at line 79 of file kernel.c.
References file, boot_kernel_t::header, NULL, elf_hdr_t::shdrAmount, boot_kernel_t::shdrCount, elf_hdr_t::shdrOffset, boot_kernel_t::shdrs, and elf_hdr_t::shdrSize.
Referenced by kernel_load().
|
static |
Definition at line 145 of file kernel.c.
References ELF_SHDR_TYPE_DYNSYM, ELF_SHDR_TYPE_STRTAB, ELF_SHDR_TYPE_SYMTAB, elf_shdr_t::entrySize, file, find_section_by_type(), boot_kernel_t::header, is_valid_shdr(), elf_shdr_t::link, NULL, elf_shdr_t::offset, boot_kernel_t::shdrCount, boot_kernel_t::shdrs, elf_hdr_t::shdrSize, elf_shdr_t::size, boot_kernel_t::stringTable, boot_kernel_t::stringTableSize, boot_kernel_t::symbolCount, boot_kernel_t::symbols, and elf_shdr_t::type.
Referenced by kernel_load().