wazabin_userland/lib.rs
1//! A Linux x86-64 userland environment on top of the [`qcode_vm`] emulator.
2//!
3//! The crate loads a static ELF executable into the VM's MMU, builds the SysV
4//! initial process stack, and services Linux system calls on the host.
5//!
6//! # How a system call reaches the host
7//!
8//! The x86-64 `syscall` instruction lifts, in the SLEIGH x86 specification, to
9//! a user-defined p-code operation (`define pcodeop syscall`). The QCode
10//! emulator has no semantics for it and the VM stops with
11//! [`VmExit::Interrupt`](qcode_vm::VmExit::Interrupt), the machine positioned
12//! at the operation with everything before it retired. The environment
13//! services the call and resumes with [`Vm::resume`](qcode_vm::Vm::resume).
14//! See [`process`] for the exact rule.
15//!
16//! # Layout
17//!
18//! - [`loader`]: places an ELF64 image into guest memory.
19//! - [`stack`]: builds `argc`/`argv`/`envp`/auxv.
20//! - [`fs`]: the file-descriptor table and the (optionally sandboxed) host
21//! filesystem behind it.
22//! - [`syscall`]: the Linux system call dispatcher.
23//! - [`process`]: the run loop that ties the above to the VM.
24
25pub mod errno;
26pub mod fs;
27pub mod guest;
28pub mod loader;
29pub mod process;
30pub mod regs;
31pub mod stack;
32pub mod syscall;
33
34pub use process::{Config, Crash, Process, ProcessExit};