Skip to main content

Crate kh_runtime

Crate kh_runtime 

Source
Expand description

Native ARM64 execution context, guest memory layout, and trap hooks.

Dependency rule: this crate must not depend on kh-loader or kh-cli.

unsafe is denied by workspace lints and only allowed in tightly scoped modules (host, mem/*, trap, entry, and bottle::read_c_string).

Re-exports§

pub use bottle::BottleError;
pub use bottle::BottleStatus;
pub use bottle::CreateOptions;
pub use bottle::CreateResult;
pub use bottle::DARWIN_7ZZ_URL;
pub use bottle::DEFAULT_7ZZ_PATH;
pub use bottle::ENV_7ZZ;
pub use bottle::GUEST_7ZZ_REL;
pub use bottle::GUEST_LIBCXX_REL;
pub use bottle::GUEST_LIBCXX_TARGET;
pub use bottle::GUEST_PATH_DIRS;
pub use bottle::InstallPackage;
pub use bottle::InstallReport;
pub use bottle::PathError;
pub use bottle::ToolError;
pub use bottle::active_root;
pub use bottle::bottle_root;
pub use bottle::create as create_bottle;
pub use bottle::create_with as create_bottle_with;
pub use bottle::destroy as destroy_bottle;
pub use bottle::discover_7zz;
pub use bottle::ensure as ensure_bottle;
pub use bottle::guest_path_to_host;
pub use bottle::install_package;
pub use bottle::package_host_path;
pub use bottle::resolve_guest_program;
pub use bottle::set_bottle_root;
pub use bottle::status as bottle_status;
pub use bottle::translate_path;
pub use bottle::translate_path_with_root;
pub use process::ProcessState;
pub use process::reset_run;
pub use entry::EntryError;
pub use entry::call_guest;
pub use entry::call_guest_args;
pub use entry::jump_to_guest;
pub use entry::jump_to_guest_args;
pub use mem::AddressSpace;
pub use mem::DARWIN_ARM64_PAGE_SIZE;
pub use mem::GuestMemory;
pub use mem::GuestPageSize;
pub use mem::HostPageSize;
pub use mem::MapError;
pub use mem::MapRequest;
pub use mem::MappedRegion;
pub use mem::PageError;
pub use mem::PageLayout;
pub use mem::VM_PROT_EXECUTE;
pub use mem::VM_PROT_READ;
pub use mem::VM_PROT_WRITE;
pub use mem::map_stack;
pub use mem::mprotect_darwin;
pub use mem::mprotect_rw;
pub use mem::register_borrowed;
pub use mem::registry_clear;
pub use mem::registry_install;
pub use mem::registry_take;
pub use regs::ThreadRegs;
pub use stack::StackError;
pub use stack::bootstrap_stack;
pub use syscall::BsdSyscall;
pub use syscall::SyscallArgs;
pub use syscall::SyscallResult;
pub use syscall::known_syscalls;
pub use syscall::lookup as lookup_syscall;
pub use syscall::name_of;
pub use trap::PSTATE_C;
pub use trap::TrapConfig;
pub use trap::TrapError;
pub use trap::TrapEvent;
pub use trap::TrapOutcome;
pub use trap::clear_expect_code;
pub use trap::clear_trace_on_exit;
pub use trap::clear_trampoline_cache;
pub use trap::finish_with_exit_code;
pub use trap::hypercall_entry_addr;
pub use trap::install_trap_handlers;
pub use trap::patch_svc_to_brk;
pub use trap::set_expect_code;
pub use trap::set_trace_on_exit;
pub use trap::take_trace_events;

Modules§

bottle
Bottle: path translation and single-bottle lifecycle management.
entry
Jump / call into mapped guest code (AArch64 only).
host
Host OS primitives: the only crate-level home for most libc I/O and memory syscalls used by the translator.
mem
Guest and host page geometry for Darwin arm64 images on Linux.
process
Process-wide translator state for the single guest-process model.
regs
Guest AArch64 thread register snapshot (Darwin ABI conventions later).
stack
Minimal Darwin-ish process stack bootstrap (argc / argv / env / terminator).
syscall
Table-driven Darwin BSD syscall dispatch (arm64, number in x16).
thread
Guest thread support: host pthread spawn + bsdthread_* helpers.
trap
Trap backend: rewrite Darwin svc for Linux aarch64 translation.