pub struct ProgramImage {
pub elf_type: u16,
pub entry_pc: u64,
pub segments: Vec<LoadSegment>,
pub symbols: BTreeMap<String, ProgramSymbol>,
pub imports: Vec<ImportedSymbol>,
pub interp: Option<String>,
pub brk_base: u64,
pub elf_phdr_addr: Option<u64>,
pub elf_phent_size: u16,
pub elf_phnum: u16,
}Expand description
Stores parsed ELF data in a form that the MMU can map without parsing again.
Fields§
§elf_type: u16Gives the ELF object type, such as ET_EXEC or ET_DYN.
entry_pc: u64Gives the main executable entry address before interpreter selection.
segments: Vec<LoadSegment>Owns the loadable segments that define the initial process image.
symbols: BTreeMap<String, ProgramSymbol>Maps each retained ELF symbol name to its metadata.
imports: Vec<ImportedSymbol>Lists RISC-V jump-slot relocations for future import connection.
interp: Option<String>Names the guest dynamic loader from PT_INTERP, when present.
brk_base: u64Gives the page-aligned initial heap end after all load segments.
elf_phdr_addr: Option<u64>Gives the mapped program-header address used for AT_PHDR.
elf_phent_size: u16Gives one program-header entry size used for AT_PHENT.
elf_phnum: u16Gives the program-header count used for AT_PHNUM.
Implementations§
Source§impl ProgramImage
impl ProgramImage
Sourcepub fn from_segments(entry_pc: u64, segments: Vec<LoadSegment>) -> Self
pub fn from_segments(entry_pc: u64, segments: Vec<LoadSegment>) -> Self
Builds a synthetic image from caller-supplied segments.
Sourcepub fn from_elf_bytes(bytes: &[u8]) -> Result<Self, Box<dyn Error>>
pub fn from_elf_bytes(bytes: &[u8]) -> Result<Self, Box<dyn Error>>
Accepts only RISC-V ELF64 little-endian input because the current process ABI is RV64.
Sourcepub fn exec_region_containing(&self, pc: u64) -> Option<(u64, &[u8])>
pub fn exec_region_containing(&self, pc: u64) -> Option<(u64, &[u8])>
Limits lifting to file-backed executable bytes so data and BSS are not decoded as code.
Sourcepub fn find_symbol(&self, name: &str) -> Option<&ProgramSymbol>
pub fn find_symbol(&self, name: &str) -> Option<&ProgramSymbol>
Finds one symbol by its exact ELF name for entry and register setup.
Sourcepub fn symbol_at(&self, address: u64) -> Option<&ProgramSymbol>
pub fn symbol_at(&self, address: u64) -> Option<&ProgramSymbol>
Finds the closest defined symbol at or below a mapped guest address.
Sourcepub fn imports(&self) -> &[ImportedSymbol]
pub fn imports(&self) -> &[ImportedSymbol]
Borrows sorted jump-slot imports without exposing the owned vector for changes.
Trait Implementations§
Source§impl Clone for ProgramImage
impl Clone for ProgramImage
Source§fn clone(&self) -> ProgramImage
fn clone(&self) -> ProgramImage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more