Skip to main content

Crate wazabin_userland

Crate wazabin_userland 

Source
Expand description

A Linux x86-64 userland environment on top of the qcode_vm emulator.

The crate loads a static ELF executable into the VM’s MMU, builds the SysV initial process stack, and services Linux system calls on the host.

§How a system call reaches the host

The x86-64 syscall instruction lifts, in the SLEIGH x86 specification, to a user-defined p-code operation (define pcodeop syscall). The QCode emulator has no semantics for it and the VM stops with VmExit::Interrupt, the machine positioned at the operation with everything before it retired. The environment services the call and resumes with Vm::resume. See process for the exact rule.

§Layout

  • loader: places an ELF64 image into guest memory.
  • stack: builds argc/argv/envp/auxv.
  • fs: the file-descriptor table and the (optionally sandboxed) host filesystem behind it.
  • syscall: the Linux system call dispatcher.
  • process: the run loop that ties the above to the VM.

Re-exports§

pub use process::Config;
pub use process::Crash;
pub use process::Process;
pub use process::ProcessExit;

Modules§

errno
Linux error numbers, and the -errno return convention.
fs
The file-descriptor table, and the host filesystem behind it.
guest
Guest-memory accessors: every copy between the host and the guest goes through the MMU, and a failed access surfaces as EFAULT rather than a crash of the environment.
loader
Places a static ELF64 x86-64 executable into guest memory.
process
The run loop: a loaded image, a machine, and the host services behind it.
regs
Register access that does not go through the emulator’s name lookup.
stack
The SysV x86-64 initial process stack.
syscall
The Linux x86-64 system call dispatcher.