pub struct LoadSession {
pub executable: PathBuf,
pub root: Option<PathBuf>,
pub pages: PageLayout,
pub images: Vec<ProcessImage>,
/* private fields */
}Expand description
Configuration and state for loading one guest process image set.
Ownership model: after map, images is the single source of truth for
parse / plan / GuestMemory. Before map, the main executable may live in
private staging only (no duplicated top-level fields).
Fields§
§executable: PathBufPath to the main executable.
root: Option<PathBuf>Optional bottle root (KAKEHASHI_ROOT / --root).
pages: PageLayoutHost/guest page geometry.
images: Vec<ProcessImage>Process image set (main at index 0 when mapped). Sole owner after map.
Implementations§
Source§impl LoadSession
impl LoadSession
Sourcepub fn open(
executable: impl Into<PathBuf>,
root: Option<PathBuf>,
) -> Result<Self, LoadError>
pub fn open( executable: impl Into<PathBuf>, root: Option<PathBuf>, ) -> Result<Self, LoadError>
Starts a session for executable with detected host pages and default guest size.
Sourcepub fn open_with_guest(
executable: impl Into<PathBuf>,
root: Option<PathBuf>,
guest: GuestPageSize,
) -> Result<Self, LoadError>
pub fn open_with_guest( executable: impl Into<PathBuf>, root: Option<PathBuf>, guest: GuestPageSize, ) -> Result<Self, LoadError>
Starts a session with an explicit guest page policy.
Sourcepub fn executable(&self) -> &Path
pub fn executable(&self) -> &Path
Executable path.
Sourcepub fn images(&self) -> &[ProcessImage]
pub fn images(&self) -> &[ProcessImage]
All process images (mapped + skipped), main at index 0 when mapped.
Sourcepub fn images_mut(&mut self) -> &mut [ProcessImage]
pub fn images_mut(&mut self) -> &mut [ProcessImage]
Mutable view of images (bind / patch prep).
Sourcepub fn mapped_memories_mut(&mut self) -> impl Iterator<Item = &mut GuestMemory>
pub fn mapped_memories_mut(&mut self) -> impl Iterator<Item = &mut GuestMemory>
Iterator of mapped GuestMemory mut refs (main then dylibs, map order).
Sourcepub fn load_main_image(&mut self) -> Result<&MachOImage, LoadError>
pub fn load_main_image(&mut self) -> Result<&MachOImage, LoadError>
Parses the main executable into staged (or already mapped) state.
Sourcepub fn plan_main_image(&mut self) -> Result<&ImagePlan, LoadError>
pub fn plan_main_image(&mut self) -> Result<&ImagePlan, LoadError>
Parses (if needed) and builds an image plan for the main executable.
Sourcepub fn map_main_image(&mut self) -> Result<&GuestMemory, LoadError>
pub fn map_main_image(&mut self) -> Result<&GuestMemory, LoadError>
Maps main only into images = [main] (no dependency walk).
Unit tests / simple tooling. Production dry_load and run_micro use
Self::map_process.
Sourcepub fn map_process(&mut self) -> Result<&[ProcessImage], LoadError>
pub fn map_process(&mut self) -> Result<&[ProcessImage], LoadError>
Map main once, BFS-load allowed dylibs, rebase pointer arrays, bind.
Order matches a minimal dyld load sequence: map → rebase → bind.
Bind prefers chained fixups, then classic opcodes, else nlist → __got.
Section rebase is skipped for images that use chained fixups.
Sourcepub fn dry_load(&mut self) -> Result<DryLoadReport, LoadError>
pub fn dry_load(&mut self) -> Result<DryLoadReport, LoadError>
Maps the process image set and builds a dry-load report for the CLI.
Sourcepub fn memory_mut(&mut self) -> Option<&mut GuestMemory>
pub fn memory_mut(&mut self) -> Option<&mut GuestMemory>
Mutable access to main mapped memory (after map).