⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

ElfLoader

Struct ElfLoader 

Source
pub struct ElfLoader;
Expand description

ELF loader

Implementations§

Source§

impl ElfLoader

Source

pub fn new() -> Self

Create a new ELF loader

Source

pub fn load( data: &[u8], vas: &mut VirtualAddressSpace, ) -> Result<u64, KernelError>

Load an ELF binary directly into a VAS

Source

pub fn parse(&self, data: &[u8]) -> Result<ElfBinary, ElfError>

Parse an ELF binary from a byte slice

Source

pub fn load_into_memory( &self, data: &[u8], target_base: u64, ) -> Result<u64, ElfError>

Load an ELF binary into memory

Source

pub fn parse_dynamic_section( &self, data: &[u8], dynamic_offset: u64, dynamic_size: u64, ) -> Result<DynamicInfo, ElfError>

Parse dynamic section

Source

pub fn perform_relocations( &self, base_addr: u64, relocations: &[ElfRelocation], symbols: &[ElfSymbol], ) -> Result<(), ElfError>

Perform relocations

Source

pub fn resolve_symbols( &self, data: &[u8], symtab_offset: u64, symtab_size: usize, strtab_offset: u64, strtab_size: usize, ) -> Result<Vec<ElfSymbol>, ElfError>

Resolve symbols

Source

pub fn process_relocations( &self, data: &[u8], base_addr: u64, ) -> Result<(), ElfError>

Process relocations for a loaded binary.

Scans the ELF data for a PT_DYNAMIC segment, parses the dynamic section to find relocation tables and the symbol table, then applies all relocations. Handles RELA and JMPREL (PLT) relocation tables.

Trait Implementations§

Source§

impl Default for ElfLoader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for ElfLoader

§

impl RefUnwindSafe for ElfLoader

§

impl Send for ElfLoader

§

impl Sync for ElfLoader

§

impl Unpin for ElfLoader

§

impl UnwindSafe for ElfLoader

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.