~/bend-docscommunity

host/main.bend relies on unsafe/foreign

raw source on the hub · import 0xeedc51d20a9b77c2ac19c4d8f57d45a6/host/main.bend as Main

28 imports
import Base
import ../src/lib/u64.bend as U
import ../src/lib/bytes.bend as B
import ../src/vmm/abi.bend as V
import ../src/vmm/layout.bend as L
import ../src/vmm/machine.bend as M
import ../src/vmm/snapshot.bend as Snap
import ../src/vmm/snapfile.bend as Sf
import ../src/vmm/control.bend as Ctl
import ../src/dev/pointer.bend as Ptr
import ../src/vmm/cli.bend as Cli
import ../src/disk/access.bend as Acc
import ../src/net/limits.bend as Lim
import ../src/net/nat.bend as Nt
import ../src/arm64/psci.bend as Ps
import ../src/virtio/device.bend as D
import ../src/virtio/input.bend as In
import ../src/dev/keymap.bend as Km
import ../src/dev/pflash.bend as Pf
import ../src/dev/escape.bend as Es
import ../src/net/addr.bend as Ad
import ../src/boot/image.bend as I
import ../src/boot/dtb.bend as T
import ./hvf.bend as H
import ./fs.bend as Fs
import ./version.bend as Ver
import ../src/disk/store.bend as St
import ../src/disk/qcow2.bend as Qc

Types

type Opts source · line 59 · raw

Data

type Fwd source · line 1430 · raw

Data

Definitions

def log_err source · line 45 · raw

@msg:String -> IO(Unit)

A VMM message on stderr, after the guest's console output so far.

def log_gated source · line 52 · raw

@drop:Bool -> @+g:U32 -> @msg:String -> IO(Unit)

A VMM message, unless the gate (Hvf.log_gate) dropped it; with a count of the ones dropped before it.

def Opts.default source · line 62 · raw

Opts

def Opts.mem source · line 65 · raw

@o:Opts -> U32

def Opts.disk source · line 70 · raw

@o:Opts -> String

def Opts.kernel source · line 75 · raw

@o:Opts -> String

def Opts.share source · line 80 · raw

@o:Opts -> String

def Opts.restore source · line 85 · raw

@o:Opts -> String

def Opts.control source · line 90 · raw

@o:Opts -> String

def Opts.cpus source · line 95 · raw

@o:Opts -> U32

def Opts.vsock source · line 100 · raw

@o:Opts -> String

def Opts.firmware source · line 105 · raw

@o:Opts -> String

def Opts.vars source · line 110 · raw

@o:Opts -> String

def Opts.forward source · line 115 · raw

@o:Opts -> String

def Opts.lan source · line 120 · raw

@o:Opts -> String

def Opts.display source · line 125 · raw

@o:Opts -> String

def display_of source · line 131 · raw

@spec:String -> Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/dtb.Display>

"WxH" or "WxH,headless" as a display (src/vmm/cli.bend).

def display_window source · line 136 · raw

@+spec:String -> Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/dtb.Display>

The display to open a window for: none when headless ("WxH,headless": the framebuffer and screendump only, no window to take the host's pointer).

def Opts.num source · line 139 · raw

@s:String -> @d:U32 -> U32

def Opts.set source · line 142 · raw

@+flag:String -> @+v:String -> @o:Opts -> Opts

def Opts.parse source · line 165 · raw

@args:List<&1, String> -> @o:Opts -> Opts

def ram source · line 176 · raw

0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64

def ram_bytes source · line 180 · raw

@mem:U32 -> 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64

RAM size in bytes for mem MiB.

def err source · line 183 · raw

U32

def die_if source · line 186 · raw

@bad:Bool -> @what:String -> IO(Unit)

def boot_regs source · line 194 · raw

@+cpu:U32 -> @entry:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> @x0:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> IO(Unit)

Boot registers: PC at entry, X0 the DTB, EL1h with DAIF masked (0x3c5).

def advance_pc source · line 201 · raw

@cpu:U32 -> IO(U32)

def take.got source · line 205 · raw

@got:Maybe<&1, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine> -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine)

The machine lives in a one-slot channel: take it, handle an exit, put it back.

def take source · line 212 · raw

@mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine)

def put source · line 217 · raw

@mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @m:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine -> IO(Unit)

def flash_cmd source · line 223 · raw

@cmd:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/abi.FlashCmd -> IO(U32)

A UEFI flash command on bank 1 (host/hvf.c, Hvf.flash).

def vkey source · line 235 · raw

@+conn:U32 -> U32

A vsock connection's key in the host's socket table (apart from the NAT's).

def net_slirp source · line 375 · raw

@m:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine -> 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/net/nat.Slirp

def net_room source · line 383 · raw

@+m:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine -> @udp:Bool -> @+conn:U32 -> Bool

Whether a reader may read on: few frames pending for the guest, and (a TCP reader, not udp) its connection queues less than Nt.Slirp.queue_cap bytes for the guest.

def resume_if source · line 608 · raw

@was_running:Bool -> IO(Unit)

def snap.commit source · line 619 · raw

@path:String -> @plan:Maybe<&2, List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Piece>> -> IO(U32)

Writes what Hvf.snap_save holds as src/vmm/snapfile.bend lays it out; EFBIG (27) when a loader would refuse the file.

def snap.place source · line 629 · raw

@ok:Bool -> @rc:U32 -> @tmp:String -> @path:String -> IO(U32)

A written snapshot (rc 0) renamed into place.

def reply_rc source · line 651 · raw

@+rc:U32 -> @ok:String -> String

def display.is_close source · line 914 · raw

@ev:Event -> Bool

def display.map source · line 986 · raw

@d:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/dtb.Display> -> IO(Unit)

Maps the framebuffer when --display asks for one.

def base_devices source · line 1104 · raw

List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>

Devices, in slot order: virtio-rng, virtio-console (hvc0), virtio-net (the user-mode NAT), then a virtio-blk with --disk and a virtio-9p (tag "share") with --share.

def devices.kind source · line 1108 · raw

@ro:Bool -> @+id:U32 -> @sectors:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind

One disk image: "path" (read-write) or "path:ro" (read-only).

def bytes_str source · line 1115 · raw

@bs:List<&2, U32> -> String

def path_dir source · line 1124 · raw

@+p:String -> String

The directory part of a path ("." for none), and a path relative to it (an absolute one stays as it is).

def path_under source · line 1128 · raw

@+dir:String -> @+name:String -> String

def devices.share source · line 1236 · raw

@none:Bool -> @dir:String -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

def devices.vsock source · line 1248 · raw

@none:Bool -> @path:String -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

--vsock PATH: a virtio-vsock device (guest CID 3) whose host side is Unix sockets under PATH.

def devices.input source · line 1260 · raw

@none:Bool -> List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>

A virtio keyboard, always (the power button), and with --display a tablet for the window.

def initrd_of source · line 1296 · raw

@present:Bool -> @start:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> @end:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/dtb.Initrd>

def place_initrd source · line 1303 · raw

@present:Bool -> @path:String -> @at:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> IO(U32)

def no_image source · line 1310 · raw

0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/image.ImageInfo

def boot_linux.lay source · line 1314 · raw

@lay:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/image.Layout -> @o:Opts -> @+ilen:U32 -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

Writes the DTB and the initrd where the layout says; answers (entry, dtb).

def boot_linux.placed source · line 1326 · raw

@placed:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/image.Layout> -> @o:Opts -> @ilen:U32 -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

def boot_linux source · line 1335 · raw

@+o:Opts -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

Loads the kernel at the start of RAM (text_offset 0, every kernel since 3.17), then places the DTB and initrd after it.

def boot_payload source · line 1349 · raw

@+o:Opts -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

A bare-metal payload runs from the start of RAM, with the DTB 64 MiB in.

def boot_uefi source · line 1363 · raw

@+o:Opts -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

--firmware: UEFI firmware runs in place from flash bank 0 (address 0) and finds the device tree, with the flash banks in it, at the start of RAM, as edk2's ArmVirtQemu expects of QEMU's virt machine.

def boot.kernel source · line 1377 · raw

@payload:Bool -> @o:Opts -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

def boot.go source · line 1384 · raw

@kernel:Bool -> @+o:Opts -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

def boot source · line 1391 · raw

@+o:Opts -> @nslots:Nat -> IO(Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64))

def stopped.reset source · line 1395 · raw

@reset:Bool -> @+code:U32 -> IO(Unit)

Stop code 1 is a guest reset: start over in a fresh process.

def stopped source · line 1407 · raw

@+code:U32 -> IO(Unit)

def fwd_port.ok source · line 1433 · raw

@m:Maybe<&2, U32> -> Maybe<&2, U32>

def fwd_port source · line 1441 · raw

@s:String -> Maybe<&2, U32>

A port: 1 to 65535.

def fwd_mk source · line 1444 · raw

@addr:String -> @h:Maybe<&2, U32> -> @g:Maybe<&2, U32> -> Maybe<&2, Fwd>

def fwd_parse.parts source · line 1451 · raw

@parts:List<&2, String> -> Maybe<&2, Fwd>

def fwd_parse source · line 1461 · raw

@spec:String -> Maybe<&2, Fwd>

"[ADDR:]HOSTPORT:GUESTPORT" as a forward; None for anything malformed.

def fwd_specs source · line 1464 · raw

@s:String -> List<&2, String>

def fwd_max source · line 1469 · raw

U32

The most forwards (host/hvf.c, HVF_MAX_FWDS).

def shutdown_ms source · line 1545 · raw

U32

SIGTERM and SIGHUP press the guest's power button and give it shutdown_ms to power off; SIGINT, a second signal, or the time running out stop the VMM at once (exit status 128 + the signal).

def resolver.got source · line 1583 · raw

@r:Pair(File, Result<&1, &1, Pair(U32, String), String>) -> IO(String)

Runs a machine: the vCPU loops of the given CPUs, console input and the control socket; ends when a vCPU stops the VM.

def resolver.opened source · line 1590 · raw

@r:Result<&1, &1, Pair(U32, String), File> -> IO(String)

def resolver source · line 1600 · raw

IO(Unit)

The host's resolver, for the guest's DNS server 10.0.2.3 (src/net/addr.bend).

def forget_lan source · line 1657 · raw

@ds:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.Dev> -> List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.Dev>

def forget_net source · line 1666 · raw

@m:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine -> 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine

After a restore the host holds nothing: the NAT's connections and the LAN frame it held are gone.

def psci_on source · line 1671 · raw

@m:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine -> List<&2, Bool>

def Opts.with_forward source · line 1717 · raw

@o:Opts -> @fd:String -> Opts

Options for a restore: the snapshot's own, plus this run's --control. o with this run's --forward (forwards are not the snapshot's: they come from the command line that restores it).

def Opts.with_size source · line 1723 · raw

@o:Opts -> @mem:U32 -> @cpus:U32 -> Opts

o with the RAM and vCPUs a restore makes (the snapshot header's).

def restore.opts source · line 1728 · raw

@saved:List<&1, String> -> @now:Opts -> Opts

def restore.flash source · line 1735 · raw

@none:Bool -> @+o:Opts -> IO(Unit)

A UEFI guest's flash banks come back from the same firmware and variable files; bank 1 stays unmapped when the snapshot caught a flash command.

def restore.flash_mode source · line 1746 · raw

@m:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine> -> IO(U32)

def restore.differs.one source · line 1757 · raw

@+flag:String -> @+was:String -> @+now:String -> String

A snapshot names the host files and sockets its devices use. Restoring it opens them only when this command line names the same ones, so a snapshot from elsewhere cannot choose what to open, share or replace: the first flag that differs, as a message ("" when none does).

def restore.differs.first source · line 1763 · raw

@+a:String -> @b:String -> String

def restore.differs source · line 1766 · raw

@+was:Opts -> @+now:Opts -> String

def kinds_words source · line 1775 · raw

@ks:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind> -> List<&2, U32>

The devices of a machine, as their snapshot words (Snap's Enc.kind).

def devs_kinds source · line 1782 · raw

@ds:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.Dev> -> List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>

def machine_kinds source · line 1789 · raw

@m:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine> -> List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>

def words_eq source · line 1796 · raw

@a:List<&2, U32> -> @b:List<&2, U32> -> Bool

def snap.bad source · line 1807 · raw

IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Layout)

Reading a snapshot's layout (src/vmm/snapfile.bend): the header, then each length prefix where Snapf.need says, then the parts the layout names.

def snap.load source · line 1810 · raw

@fits:Bool -> @+l:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Layout -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Layout)

def snap.next source · line 1821 · raw

@full:Bool -> @+h:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Head -> @+lens:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64> -> 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Need

The next step once a length prefix is read: a short read is a bad file.

def snap.walk source · line 1830 · raw

@fuel:Nat -> @need:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Need -> @+h:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Head -> @+lens:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64> -> @+size:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Layout)

fuel: the header's length prefixes (words, GIC, at most 64 vCPUs) and one more step. One def, recursing on fuel only: no @unsafe, no forward calls.

def snap.start source · line 1846 · raw

@h:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Head> -> @+size:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/snapfile.Layout)

def usage source · line 1895 · raw

String

def main.info.pick source · line 1906 · raw

@+first:String -> Maybe<&2, String>

def main.info source · line 1911 · raw

@args:List<&1, String> -> Maybe<&2, String>

The first argument asks for the version or the usage (so does none).

def args_bytes source · line 1930 · raw

@args:List<&1, String> -> List<&2, U32>

Arguments as the host keeps them: each one's bytes, then a 0.

Unsafe

unsafe interp source · line 240 · raw

@+cpu:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @-A:Type -> @m:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/abi.Vm<A> -> IO(A)

Runs the Vm program of an exit of vCPU cpu. VmCpuOn starts that vCPU's loop, which is defined below (hence @unsafe: the two recurse into each other).

unsafe net_deliver source · line 369 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @ev:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/abi.NetEvent -> IO(Unit)

Host network: the NAT's commands run on host sockets; what the sockets report comes back as NetEvents, each delivered by a task of its own (the machine is held while a Vm program runs, so delivery must wait its turn).

unsafe net_wait source · line 389 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+udp:Bool -> @+conn:U32 -> @+ms:U32 -> IO(Unit)

Backpressure: the link to the guest must stay lossless, so a reader waits as long as net_room says no (looking again after 2 ms, then less often, at least every 16 ms); it never reads on regardless.

unsafe net_wait.go source · line 395 · raw

@ok:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+udp:Bool -> @+conn:U32 -> @+ms:U32 -> IO(Unit)

unsafe tcp_reader.got source · line 404 · raw

@eof:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> @bs:List<&2, U32> -> IO(Unit)

unsafe tcp_reader.small source · line 414 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe tcp_reader.held source · line 419 · raw

@eof:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> @n:U32 -> IO(Unit)

unsafe tcp_reader.mode source · line 428 · raw

@big:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe tcp_reader source · line 441 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

A connection's reader. A guest that takes 64 KiB segments gets the host's data as V.TcpReady: up to 65495 bytes held on the host, moved into guest memory when delivered (Hvf.tcp_fill waits for that before it reads more). Otherwise the bytes go through the NAT as V.TcpData.

unsafe tcp_task.connected source · line 447 · raw

@ok:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe tcp_task source · line 458 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe tcp_flusher.got source · line 466 · raw

@open:Bool -> @full:Bool -> @reset:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

A NAT connection's flusher (Hvf.tcp_flush): it tells the NAT when the host's pending data for the connection blocks or unblocks it, or when the host reset the connection, and ends once nothing is pending.

unsafe tcp_flusher source · line 481 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe udp_task.got source · line 489 · raw

@stop:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+flow:U32 -> @+sport:U32 -> @+ws:List<&2, U32> -> IO(Unit)

A UDP flow's receiver (flow: its number, Hvf.udp_send): datagrams for guest port sport, as the guest's frames leave room; it ends when the flow closes.

unsafe udp_task source · line 500 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+flow:U32 -> @+sport:U32 -> IO(Unit)

unsafe net_cmd.connect source · line 505 · raw

@ok:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe net_cmd.udp source · line 512 · raw

@fresh:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+flow:U32 -> @+sport:U32 -> IO(Unit)

unsafe net_cmd.sent source · line 521 · raw

@flush:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

Guest data the socket did not take at once waits on the host: a flusher starts when the send says so.

unsafe net_cmd source · line 528 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @cmd:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/abi.NetCmd -> IO(Unit)

unsafe wait_stopped source · line 584 · raw

@fuel:Nat -> IO(Unit)

Waits until no vCPU is inside the guest (they stop at the pause gate).

unsafe wait_stopped.go source · line 593 · raw

@done:Bool -> @fuel:Nat -> IO(Unit)

unsafe pause_vm source · line 602 · raw

IO(U32)

unsafe snapshot source · line 638 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @path:String -> IO(U32)

Pauses (if running), writes the snapshot while holding the machine, and resumes if it was running. Answers 0 or an errno.

unsafe display.hid source · line 655 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @ev:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/input.Hid -> IO(Unit)

A keyboard or pointer report into the machine (M.Machine.hid).

unsafe type_keys source · line 661 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @evs:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/input.Hid> -> IO(Unit)

unsafe power_button source · line 673 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

The guest's power button: KEY_POWER (116) pressed and released on the virtio keyboard; a guest that handles it (systemd-logind, acpid) shuts down and powers off.

unsafe command.run source · line 677 · raw

@c:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/control.Cmd -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(String)

A control command (src/vmm/control.bend says which a line is), carried out.

unsafe ctl_loop.got source · line 728 · raw

@got:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/control.Cmd> -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe ctl_loop source · line 738 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe escape.run source · line 745 · raw

@is_p:Bool -> @is_s:Bool -> @paused:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

A console escape: p toggles pause, s snapshots to ./bend-vmm.snap, h prints the keys.

unsafe lan_loop source · line 767 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

vsock: the device's commands run on Unix sockets (host/hvf.c); what the sockets report comes back as VsockEvents, each delivered by its own task. The LAN NIC's receiver: the host holds a frame another VM sent (once the last one is released) and the device copies it into the guest's buffers (VmLanToRam, then LanRelease). Without a LAN it parks for good.

unsafe vs_deliver source · line 775 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @ev:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/abi.VsockEvent -> IO(Unit)

unsafe vs_reader.got source · line 785 · raw

@eof:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> @+n:U32 -> IO(Unit)

A vsock connection's reader: the host holds what the program sent (up to Hvf.tcp_fill's buffer) and the device copies it into the guest's buffers (VmVsToRam); once all of it is out (VsRelease) the host reads again, so the guest's pace holds the program back. EOF or an error ends it.

unsafe vs_reader source · line 794 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe vs_task.connected source · line 799 · raw

@ok:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe vs_task source · line 810 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe vs_connect.go source · line 815 · raw

@ok:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe vs_flusher.got source · line 827 · raw

@open:Bool -> @full:Bool -> @reset:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

A vsock connection's flusher: the host program's socket takes the guest's data when it can (Hvf.nat_send queues the rest, as for the NAT), so a program that stops reading never holds the event loop. While it is behind the guest gets no credit (VsBlocked, VsUnblocked); if it stays stuck past the host's limits the socket is reset and the guest sees the host side end.

unsafe vs_flusher source · line 842 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe vs_sent source · line 847 · raw

@flush:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe vsock_cmd source · line 855 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @cmd:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/abi.VsockCmd -> IO(Unit)

The --vsock base path, kept by the C side (Hvf.vsock_base).

unsafe vs_accept_loop.got source · line 893 · raw

@stop:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+ws:List<&2, U32> -> IO(Unit)

Host clients asking for guest ports.

unsafe vs_accept_loop source · line 902 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe display.events source · line 923 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @evs:List<&1, Event> -> IO(Bool)

Each window event as keyboard and tablet reports (src/dev/pointer.bend); closing the window stops the VM.

unsafe display.event source · line 930 · raw

@close:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @ev:Event -> @rest:List<&1, Event> -> IO(Bool)

unsafe display.loop source · line 941 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @win:Window -> IO(Unit)

unsafe display.next source · line 946 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @r:Pair(Window, List<&1, Event>) -> IO(Unit)

unsafe display.again source · line 953 · raw

@closed:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @win:Window -> IO(Unit)

unsafe display.first source · line 962 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @r:Pair(Window, Pair(Image, List<&1, Event>)) -> IO(Unit)

unsafe display.opened source · line 967 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+w:U32 -> @+h:U32 -> @r:Result<&1, &1, Pair(U32, String), Window> -> IO(Unit)

unsafe display.start source · line 976 · raw

@d:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/boot/dtb.Display> -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe input_feed source · line 1002 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @bs:List<&2, U32> -> @+tries:U32 -> IO(Unit)

Bytes typed on the host console go to the UART: this loop parks on stdin and hands each chunk to the machine. An idle guest may never exit (the GIC and timer live in Hypervisor.framework), so input cannot wait for exits. Pasted or piped input outruns the UART's 32-byte FIFO, so input_feed gives it what fits and the rest as the guest drains it, polling every 2 ms; after tries polls with no room (a guest not reading the UART) the rest goes anyway, and what does not fit is dropped as by the hardware.

unsafe input_key source · line 1018 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @k:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/dev/escape.Key -> IO(Unit)

A console key (src/dev/escape.bend): bytes for the guest's UART, or an escape's action.

unsafe input_keys source · line 1035 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @ks:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/dev/escape.Key> -> IO(Unit)

unsafe input_loop.fed source · line 1044 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @r:Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/dev/escape.Esc, List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/dev/escape.Key>) -> IO(Unit)

unsafe input_loop.go source · line 1051 · raw

@eof:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @bs:List<&2, U32> -> @e:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/dev/escape.Esc -> IO(Unit)

unsafe input_loop source · line 1058 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @e:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/dev/escape.Esc -> IO(Unit)

unsafe input_start source · line 1065 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

The console: a terminal's Ctrl-A keys act on the VMM; piped input all goes to the guest.

unsafe vcpu_loop source · line 1071 · raw

@+cpu:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

One vCPU: run, hand the exit to the machine, act on the answer, repeat.

unsafe vcpu_loop.ctl source · line 1078 · raw

@+cpu:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @ctl:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Control -> IO(Unit)

unsafe vcpu_loop.next source · line 1094 · raw

@+cpu:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @step:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Step -> IO(Unit)

unsafe devices.chain source · line 1134 · raw

@fuel:Nat -> @+path:String -> @+id:U32 -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/disk/store.Store)

The store an image at path (open as id) gives: a qcow2 image over its backing file's store (none when it names none), or a raw image. fuel bounds the chain.

unsafe devices.chain.layer source · line 1144 · raw

@m:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/disk/qcow2.Qcow> -> @f:Nat -> @+path:String -> @+id:U32 -> @+head:List<&2, U32> -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/disk/store.Store)

unsafe devices.backing source · line 1155 · raw

@fuel:Nat -> @+path:String -> @+id:U32 -> @b:Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, U32) -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/disk/store.Store)

The store below a qcow2 image: its backing file (name at off, len bytes; relative to the image's directory), or none.

unsafe devices.backing.at source · line 1160 · raw

@none:Bool -> @fuel:Nat -> @+path:String -> @+id:U32 -> @off:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> @+len:U32 -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/disk/store.Store)

unsafe devices.format source · line 1173 · raw

@m:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/disk/qcow2.Qcow> -> @ro:Bool -> @+path:String -> @+id:U32 -> @+head:List<&2, U32> -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind)

A disk image: qcow2 (its header says so) as a store over its backing chain, anything else raw.

unsafe devices.open source · line 1184 · raw

@ro:Bool -> @+path:String -> @+id:U32 -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind)

unsafe devices.open_as source · line 1191 · raw

@ro:Bool -> @path:String -> IO(U32)

A :ro image is opened (and locked) only for reading.

unsafe devices.retry source · line 1200 · raw

@again:Bool -> @ro:Bool -> @+path:String -> @+id:U32 -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind)

An image the host would not open for writing (src/disk/access.bend says which refusals) is attached read-only, and said so.

unsafe devices.one source · line 1210 · raw

@+spec:String -> IO(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind)

unsafe devices.disks source · line 1219 · raw

@specs:List<&2, String> -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

--disk a.img,b.img:ro gives one virtio-blk per image, in order.

unsafe devices.disk source · line 1229 · raw

@none:Bool -> @disk:String -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

unsafe devices.lan.go source · line 1269 · raw

@spec:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/cli.LanSpec> -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

--lan: the LAN NIC (src/vmm/cli.bend reads the spec; Cli.check refused a malformed one), its socket bound in the LAN directory.

unsafe devices.lan source · line 1279 · raw

@none:Bool -> @spec:String -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

unsafe devices source · line 1286 · raw

@o:Opts -> IO(List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind>)

unsafe control source · line 1411 · raw

@none:Bool -> @path:String -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

Starts the control socket when --control names one.

unsafe fwd_timer source · line 1475 · raw

@n:Nat -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

A forwarded client's SYN timer: every 2 s, while the guest has not answered the NAT's SYN, the NAT is told (it sends the SYN again, and gives up on the third time).

unsafe fwd_timer.go source · line 1486 · raw

@pending:Bool -> @n:Nat -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe fwd_client source · line 1495 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> @gport:U32 -> IO(Unit)

unsafe fwd_loop.got source · line 1500 · raw

@stop:Bool -> @+idx:U32 -> @+gport:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+conn:U32 -> IO(Unit)

unsafe fwd_loop source · line 1510 · raw

@+idx:U32 -> @+gport:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

Forward idx's clients, for guest port gport.

unsafe forwards.listened source · line 1515 · raw

@+rc:U32 -> @+idx:U32 -> @+addr:String -> @+hport:U32 -> @+gport:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe forwards.one source · line 1521 · raw

@m:Maybe<&2, Fwd> -> @+idx:U32 -> @spec:String -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe forwards source · line 1533 · raw

@+idx:U32 -> @specs:List<&2, String> -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

Listens for every forward (one that cannot listen, its port taken or its address not the host's, stops the VMM) and accepts their clients.

unsafe signals.late source · line 1548 · raw

@+sig:U32 -> @+done:Chan(U32) -> IO(Unit)

unsafe signals.got source · line 1555 · raw

@soft:Bool -> @+sig:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe signals.on source · line 1568 · raw

@fail:Bool -> @first:Bool -> @+sig:U32 -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe signals source · line 1576 · raw

@first:Bool -> @+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> IO(Unit)

unsafe run_machine source · line 1607 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @+ctl:String -> @disp:String -> @fwd:String -> @cpus:List<&2, U32> -> IO(Unit)

unsafe spawn_cpus source · line 1622 · raw

@+mc:Chan(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine) -> @+done:Chan(U32) -> @cpus:List<&2, U32> -> IO(Unit)

unsafe start.go source · line 1631 · raw

@cpus:U32 -> @ctl:String -> @disp:String -> @fwd:String -> @kinds:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind> -> @pc:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> @dtb:0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64 -> IO(Unit)

unsafe start source · line 1641 · raw

@o:Opts -> @kinds:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind> -> @entry:Pair(0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/lib/u64.U64) -> IO(Unit)

unsafe restore_cpus source · line 1678 · raw

@i:U32 -> @saved:List<&2, U32> -> @+on:List<&2, Bool> -> IO(List<&2, U32>)

CPU indexes i (from i0) whose saved flag is set, created now; answers the ones PSCI has on.

unsafe restore_cpu source · line 1690 · raw

@saved:Bool -> @i:U32 -> IO(U32)

unsafe restore.machine source · line 1697 · raw

@got:Maybe<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/vmm/machine.Machine> -> @+o:Opts -> @kinds:List<&2, 0xeedc51d20a9b77c2ac19c4d8f57d45a6/src/virtio/device.DevKind> -> IO(Unit)

unsafe restore source · line 1853 · raw

@path:String -> @+now:Opts -> IO(Unit)

unsafe boot_fresh source · line 1879 · raw

@+o:Opts -> IO(Unit)

unsafe main.mode source · line 1888 · raw

@fresh:Bool -> @+o:Opts -> IO(Unit)

unsafe main.go source · line 1918 · raw

@info:Maybe<&2, String> -> @+args:List<&1, String> -> IO(Unit)

unsafe Vmm.run source · line 1942 · raw

@+prog:List<&1, String> -> @+flags:List<&1, String> -> IO(Unit)

The VMM as a library (one VM per process: the host layer's state is the process's). prog is how this program starts the VMM again, on a guest reset (Hvf.reexec) and in a snapshot's saved command line: ["bend-vmm"], or a caller's ["vk8s", "vmm"]. flags are the VMM's options, as on the command line. Errors end the process (IO.die); so do quit and power off.

unsafe main source · line 1949 · raw

IO(Unit)