~/bend-docscommunity

host/hvf.bend relies on unsafe/foreign

raw source on the hub · import 0x2bd5a34a6e8be8eb2ccde942133379fd/host/hvf.bend as Hvf

15 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/boot/image.bend as I
import ../src/vmm/loggate.bend as Lg
import ../src/net/flush.bend as Fl
import ../src/net/limits.bend as Lm
import ../src/arm64/kvmexit.bend as Kx
import ../src/arm64/gicplan.bend as Gp
import ../src/arm64/regplan.bend as Rp
import ../src/net/fds.bend as Fd
import ../src/vmm/hostfiles.bend as Hf
import ../src/host/range.bend as Rg
import ../src/host/transfer.bend as Xf

Definitions

def Hvf.log_gate.put source · line 187 · raw

@o:0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/loggate.GateOut -> IO(U32)

def Hvf.log_gate source · line 196 · raw

IO(U32)

Whether a VMM message may go to stderr (src/vmm/loggate.bend decides): 0 drops it; otherwise 1 + the messages dropped since the last one printed.

def Op.create source · line 702 · raw

U32

vCPU request codes (host/hvf.c).

def Op.run source · line 704 · raw

U32

def Op.set_reg source · line 706 · raw

U32

def Op.get_reg source · line 708 · raw

U32

def Op.set_vtimer_mask source · line 710 · raw

U32

def Op.advance_pc source · line 712 · raw

U32

def Reg.cpsr source · line 716 · raw

U32

Register numbers beyond V.Reg: 32 is CPSR.

def Host.vm_init source · line 721 · raw

@ram_mb:U32 -> @gicd:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @gicr:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @ram:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @+cpus:U32 -> IO(U32)

Makes the VM, then hands over what a snapshot keeps (the vGIC replay and the register keys).

def Host.head.read source · line 730 · raw

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

A file's first bytes (at most 16; [] when it cannot be read).

def Host.head.opened source · line 741 · raw

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

def Host.head source · line 750 · raw

@path:String -> IO(List<&2, U32>)

def Host.head_n.opened source · line 756 · raw

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

A file's first n bytes ([] when it cannot be read).

def Host.head_n source · line 765 · raw

@path:String -> @n:U32 -> IO(List<&2, U32>)

def Host.load.go source · line 773 · raw

@+path:String -> @+h:U32 -> @+l:U32 -> @+head:List<&2, U32> -> @z:Maybe<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/boot/image.Zboot> -> IO(U32)

Copies a file into RAM at gpa, inflating it when it is gzip-compressed, or only its gzip payload when it is an EFI zboot image (src/boot/image.bend decides from its first bytes): its size in RAM, or 0xFFFFFFFF.

def Host.load_raw source · line 782 · raw

@+path:String -> @gpa:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> IO(U32)

Copies a file into RAM at gpa as it is (an initrd: the kernel unpacks a compressed one itself): its size, or 0xFFFFFFFF.

def Host.load source · line 787 · raw

@+path:String -> @gpa:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> IO(U32)

def Host.write source · line 794 · raw

@gpa:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @bytes:List<&2, U32> -> IO(U32)

def Host.read source · line 799 · raw

@gpa:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @len:U32 -> IO(List<&2, U32>)

def Host.first source · line 804 · raw

@ws:List<&2, U32> -> U32

def Host.vcpu_create source · line 807 · raw

@cpu:U32 -> IO(U32)

def Host.set_reg source · line 813 · raw

@cpu:U32 -> @reg:U32 -> @v:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> IO(U32)

Queued: applied by the vCPU thread before its next request.

def Host.advance_pc source · line 819 · raw

@cpu:U32 -> IO(U32)

Queued, like Host.set_reg: PC += 4.

def Host.get_reg source · line 822 · raw

@cpu:U32 -> @reg:U32 -> IO(0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64)

def Host.vtimer_mask source · line 827 · raw

@cpu:U32 -> @masked:U32 -> IO(U32)

def Host.exception source · line 835 · raw

@ws:List<&2, U32> -> 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.RawExit

An exit record: [kind, esr, far, ipa, x0, x1, x2, x3, xt], each 64-bit value as (hi, lo). One pattern match decodes it (walking the list per field was the hottest code on the exit path).

def Host.decode_exit.kind source · line 842 · raw

@is0:Bool -> @is1:Bool -> @is2:Bool -> @kind:U32 -> @rest:List<&2, U32> -> 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.RawExit

def Host.decode_exit source · line 854 · raw

@ws:List<&2, U32> -> 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.RawExit

Decodes Hvf.vcpu(.., Op.run(), ..) words into a RawExit.

def Host.run source · line 861 · raw

@cpu:U32 -> IO(0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.RawExit)

def Host.disk_read source · line 866 · raw

@disk:U32 -> @off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @len:U32 -> IO(List<&2, U32>)

def Host.disk_write source · line 871 · raw

@disk:U32 -> @off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @bytes:List<&2, U32> -> IO(U32)

def Host.iovs source · line 878 · raw

@xs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> List<&2, U32>

Pieces of guest memory as the host takes them: each addr (8 bytes) then len (4), little-endian.

def Host.pieces source · line 886 · raw

@xs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/host/range.Piece>

Pieces as src/host/range.bend has them, and back as the host takes them.

def Host.piece_bytes source · line 893 · raw

@xs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/host/range.Piece> -> List<&2, U32>

def Host.io_of source · line 901 · raw

@+ws:List<&2, U32> -> 0x2bd5a34a6e8be8eb2ccde942133379fd/src/host/transfer.Io

What an attempt that fell short did (Hvf.disk_short).

def Host.disk_fail source · line 907 · raw

@+disk:U32 -> @+rc:U32 -> IO(U32)

A failure is latched for Hvf.disk_status.

def Host.disk_go source · line 916 · raw

@fuel:Nat -> @nx:0x2bd5a34a6e8be8eb2ccde942133379fd/src/host/transfer.Next -> @+disk:U32 -> @+dir:U32 -> @+off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @+ps:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/host/range.Piece> -> @+want:U32 -> IO(U32)

A transfer that fell short, as src/host/transfer.bend decides: another attempt from the next byte (Range.advance), until every byte moved, a stop (a read zero-fills the rest; a write that stopped short fails) or a failure. fuel: the most attempts.

def Host.disk_copy.after source · line 938 · raw

@ok:Bool -> @+disk:U32 -> @+dir:U32 -> @+off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @+iovs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> IO(U32)

def Host.disk_copy.at source · line 948 · raw

@+disk:U32 -> @+dir:U32 -> @+oh:U32 -> @+ol:U32 -> @+iovs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> IO(U32)

def Host.disk_copy source · line 957 · raw

@disk:U32 -> @dir:U32 -> @off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @iovs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> IO(U32)

Moves bytes between a disk and pieces of guest RAM on the host: dir 0 disk to RAM, 1 RAM to disk. A complete transfer is one host call; one that falls short comes back to Bend (Host.disk_go). (The signature and shape stay as they were: interp calls this on the exit path's dispatch.)

def Host.net_copy source · line 964 · raw

@conn:U32 -> @off:U32 -> @iovs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> IO(U32)

Copies the bytes from offset off of what the host holds for TCP connection conn into pieces of guest RAM.

def Host.stage source · line 968 · raw

@iovs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> IO(U32)

Copies pieces of guest RAM into a staged slot on the host.

def Host.disk_alloc source · line 971 · raw

@disk:U32 -> @len:U32 -> IO(0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64)

def Host.disk_space.go source · line 977 · raw

@+op:U32 -> @+disk:U32 -> @+h:U32 -> @+l:U32 -> @+len:U32 -> IO(List<&2, U32>)

VmDiskSpace on the host: op 0 the hint and size, 1 set the hint, 2 zero.

def Host.disk_space source · line 983 · raw

@disk:U32 -> @op:U32 -> @at:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @len:U32 -> IO(List<&2, U32>)

def Host.disk_discard source · line 988 · raw

@disk:U32 -> @off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @len:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> IO(U32)

def Host.disk_xcopy source · line 993 · raw

@src:U32 -> @soff:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @dst:U32 -> @doff:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @len:U32 -> IO(U32)

def Host.inflate_ram source · line 998 · raw

@disk:U32 -> @off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @clen:U32 -> @skip:U32 -> @iovs:List<&2, 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/abi.Iov> -> IO(U32)

def Host.inflate_disk source · line 1003 · raw

@disk:U32 -> @off:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @clen:U32 -> @dst:U32 -> @doff:0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64 -> @skip:U32 -> @len:U32 -> IO(U32)

def Host.disk_size source · line 1008 · raw

@disk:U32 -> IO(0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64)

def Host.now source · line 1013 · raw

IO(0x2bd5a34a6e8be8eb2ccde942133379fd/src/lib/u64.U64)

def Host.sent.over source · line 1022 · raw

@over:Bool -> @+conn:U32 -> @+start:U32 -> IO(U32)

After a send (Hvf.nat_send, Hvf.tcp_send_staged answer [start, pending, total]): past the limits (src/net/flush.bend, Flush.over) the host drops what the connection holds and its flusher resets it. 1 when a flusher must start, else 0.

def Host.sent source · line 1029 · raw

@+conn:U32 -> @+ws:List<&2, U32> -> IO(U32)

def Host.nat_send source · line 1032 · raw

@+conn:U32 -> @bytes:List<&2, U32> -> IO(U32)

def Host.tcp_send_staged source · line 1037 · raw

@+conn:U32 -> @slot:U32 -> IO(U32)

def Host.tcp_close source · line 1043 · raw

@+conn:U32 -> IO(U32)

A close the NAT asked for: Flush.close decides from the host's facts.

def Host.nofile.set source · line 1050 · raw

@ws:List<&2, U32> -> IO(U32)

Sets the descriptor limit Bend chooses (src/net/fds.bend, Fds.soft) from what the host reports, then hands over the guest flows' budget (Fds.room).

def Host.fds source · line 1057 · raw

IO(U32)

def Host.listen.of source · line 1065 · raw

@ws:List<&2, U32> -> 0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/hostfiles.Listen

What a path to listen on holds, as src/vmm/hostfiles.bend decides (Files.listen) from the host's facts (Hvf.sock_facts).

def Host.listen.clear source · line 1074 · raw

@l:0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/hostfiles.Listen -> @path:String -> IO(String)

May the VMM listen at path? "" when it may (a dead socket there is removed first), else why not.

def Host.listen.facts source · line 1083 · raw

@fits:Bool -> @+path:String -> @+max:U32 -> IO(String)

def Host.listen.ok source · line 1093 · raw

@+path:String -> IO(String)

(a path too long for a socket's address is refused first, saying so)

def Host.lan_dir.of source · line 1100 · raw

@ws:List<&2, U32> -> Bool

Whether the LAN directory may be used (Files.dir_trusted), made 0700 when missing.

def Host.lan_dir.ok source · line 1107 · raw

@+dir:String -> IO(Bool)

def Host.lan_open.go source · line 1115 · raw

@l:0x2bd5a34a6e8be8eb2ccde942133379fd/src/vmm/hostfiles.Listen -> @+dir:String -> @mac:List<&2, U32> -> IO(U32)

Joins the LAN in dir: Files decides whether the directory is trusted and whether an old socket of this MAC may be replaced; 0, or an errno.

def Host.lan_open.trusted source · line 1126 · raw

@ok:Bool -> @+dir:String -> @+mac:List<&2, U32> -> IO(U32)

def Host.lan_open source · line 1135 · raw

@+dir:String -> @+mac:List<&2, U32> -> IO(U32)

Effects (foreign code)

effect Hvf.init source · line 20 · raw

@ram_mb:U32 -> @gicd_hi:U32 -> @gicd_lo:U32 -> @gicr_hi:U32 -> @gicr_lo:U32 -> @ram_hi:U32 -> @ram_lo:U32 -> @cpus:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.load source · line 24 · raw

@path:String -> @gpa_hi:U32 -> @gpa_lo:U32 -> @gz:U32 -> @off:U32 -> @len:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.write source · line 28 · raw

@gpa_hi:U32 -> @gpa_lo:U32 -> @bytes:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.read source · line 32 · raw

@gpa_hi:U32 -> @gpa_lo:U32 -> @len:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.vcpu source · line 36 · raw

@cpu:U32 -> @op:U32 -> @a_hi:U32 -> @a_lo:U32 -> @b_hi:U32 -> @b_lo:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.vcpu_queue source · line 40 · raw

@cpu:U32 -> @op:U32 -> @reg:U32 -> @hi:U32 -> @lo:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.irq source · line 44 · raw

@intid:U32 -> @level:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.gic_route source · line 50 · raw

@reg:U32 -> @hi:U32 -> @lo:U32 -> IO(U32)

Writes the vGIC distributor register at offset reg (an SPI's routing: src/arm64/irqroute.bend); HVF_ERR where the hypervisor cannot (KVM).

foreign: host/hvf.c, host/hvf.js

effect Hvf.arch source · line 55 · raw

IO(U32)

0 arm64 guests (Hypervisor.framework, KVM on arm64), 1 x86_64 (KVM on x86_64).

foreign: host/hvf.c, host/hvf.js

effect Hvf.x86_setup source · line 59 · raw

@gsis:List<&2, U32> -> @cpuid:List<&2, U32> -> @words:List<&2, U32> -> @pics:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.x86_boot source · line 63 · raw

@cpu:U32 -> @words:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.x86_pio_put source · line 67 · raw

@words:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.x86_pio_get source · line 71 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.set_args source · line 75 · raw

@bytes:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.exe_path source · line 79 · raw

IO(String)

foreign: host/hvf.c, host/hvf.js

effect Hvf.out_limits source · line 83 · raw

@backlog:U32 -> @batch_us:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tty_mode source · line 87 · raw

@raw:U32 -> @crlf:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.sock_path_max source · line 91 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.args source · line 95 · raw

IO(List<&1, String>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.clone source · line 99 · raw

@from:String -> @to:String -> @copy:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.remove source · line 103 · raw

@path:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ctl_call source · line 107 · raw

@path:String -> @line:String -> @ms:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fsync source · line 111 · raw

@path:String -> @dir:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.chmod source · line 115 · raw

@path:String -> @mode:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.path_facts source · line 119 · raw

@path:String -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.set_mtime source · line 123 · raw

@path:String -> @hi:U32 -> @lo:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ls source · line 127 · raw

@dir:String -> IO(List<&1, String>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.rmdir source · line 131 · raw

@path:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ram_kib source · line 135 · raw

@kind:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ram_settle source · line 139 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.size_kib source · line 143 · raw

@path:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.set_exec source · line 147 · raw

@path:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.reexec source · line 151 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.file_size source · line 155 · raw

@path:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.out source · line 159 · raw

@bytes:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.out_flush source · line 163 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.nofile source · line 167 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.set_nofile source · line 171 · raw

@n:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fd_room source · line 175 · raw

@n:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.log_state source · line 179 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.log_put source · line 183 · raw

@tokens:U32 -> @last_hi:U32 -> @last_lo:U32 -> @dropped:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.stdin_tty source · line 201 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.stdin_wait source · line 205 · raw

@max:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.random source · line 209 · raw

@len:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_open_with source · line 213 · raw

@path:String -> @flags:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_err source · line 217 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_status source · line 221 · raw

@disk:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.signals source · line 225 · raw

@mask:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.accept_retry source · line 229 · raw

@ms:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.signal_wait source · line 233 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_size source · line 237 · raw

@disk:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_discard source · line 241 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @len_hi:U32 -> @len_lo:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_space source · line 245 · raw

@disk:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_set_hint source · line 249 · raw

@disk:U32 -> @hi:U32 -> @lo:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_zero source · line 253 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @len:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_zero_keep source · line 257 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @len:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_flush source · line 261 · raw

@disk:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.now source · line 265 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_read source · line 269 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @len:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_write source · line 273 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @bytes:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_copy source · line 277 · raw

@disk:U32 -> @dir:U32 -> @off_hi:U32 -> @off_lo:U32 -> @iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.pack_open source · line 285 · raw

@slot:U32 -> @key:U32 -> @path:String -> @flags:U32 -> IO(List<&2, U32>)

A pack's files (src/disk/pack.bend): opens path read-only into descriptor slot as key ([0, dev, ino, size, mtime as hi/lo pairs, mtime ns] or [errno]), reads the file slot holds into guest memory (bytes moved; 0xFFFFFFFF: the slot holds another key), closes the slot's file.

foreign: host/hvf.c, host/hvf.js

effect Hvf.pack_read source · line 289 · raw

@slot:U32 -> @key:U32 -> @off_hi:U32 -> @off_lo:U32 -> @iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.pack_close source · line 293 · raw

@slot:U32 -> @key:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_short source · line 297 · raw

@disk:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_mark source · line 301 · raw

@disk:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ram_release source · line 305 · raw

@iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.zero_ram source · line 309 · raw

@iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_alloc source · line 313 · raw

@disk:U32 -> @len:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.disk_xcopy source · line 317 · raw

@src:U32 -> @soff_hi:U32 -> @soff_lo:U32 -> @dst:U32 -> @doff_hi:U32 -> @doff_lo:U32 -> @len:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.inflate_ram source · line 321 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @clen:U32 -> @skip:U32 -> @iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.inflate_disk source · line 325 · raw

@disk:U32 -> @off_hi:U32 -> @off_lo:U32 -> @clen:U32 -> @dst:U32 -> @doff_hi:U32 -> @doff_lo:U32 -> @skip:U32 -> @len:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.set_dns source · line 330 · raw

@ip:U32 -> IO(U32)

Host sockets for the NAT (see host/hvf.c, "Network").

foreign: host/hvf.c, host/hvf.js

effect Hvf.dns source · line 334 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_connect source · line 338 · raw

@conn:U32 -> @ip:U32 -> @port:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_wait source · line 342 · raw

@conn:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_recv source · line 346 · raw

@conn:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_release source · line 350 · raw

@conn:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.net_holds source · line 354 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_fill source · line 358 · raw

@conn:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.net_copy source · line 362 · raw

@conn:U32 -> @off:U32 -> @iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.stage source · line 366 · raw

@iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.stage_drop source · line 370 · raw

@slot:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_send_staged source · line 374 · raw

@conn:U32 -> @slot:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.nat_send source · line 380 · raw

@conn:U32 -> @bytes:List<&2, U32> -> IO(List<&2, U32>)

Guest data on a NAT connection, never waiting: 1 when a flusher must start (Hvf.tcp_flush), else 0.

foreign: host/hvf.c, host/hvf.js

effect Hvf.console_log source · line 387 · raw

@path:String -> @mode:U32 -> IO(U32)

A NAT connection's flusher: sends its pending data as the socket takes it. 0: TcpUnblocked, then again; 3: TcpBlocked, then again; 2: TcpReset; 1: done.

foreign: host/hvf.c, host/hvf.js

effect Hvf.console_size source · line 391 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.console_reopen source · line 395 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.meta_load source · line 399 · raw

@share:U32 -> @gdir:String -> @words:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.meta_resolve source · line 403 · raw

@share:U32 -> @gpath:String -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.meta_list source · line 407 · raw

@share:U32 -> @gdir:String -> @from:U32 -> @max:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.share_ro source · line 411 · raw

@share:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.share_quota source · line 415 · raw

@share:U32 -> @hi:U32 -> @lo:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.share_usage source · line 419 · raw

@share:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.share_inodes source · line 423 · raw

@share:U32 -> @cap:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.share_inodes_add source · line 427 · raw

@share:U32 -> @made:U32 -> @freed:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.udp_ages source · line 431 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.udp_close source · line 435 · raw

@flow:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_over source · line 439 · raw

@conn:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_flush source · line 443 · raw

@conn:U32 -> @park:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_flush_act source · line 447 · raw

@conn:U32 -> @act:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_shutdown source · line 451 · raw

@conn:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_close_facts source · line 455 · raw

@conn:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_close source · line 459 · raw

@conn:U32 -> @how:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.tcp_abort source · line 465 · raw

@conn:U32 -> IO(U32)

The guest reset a NAT connection: the host resets its socket at once and drops the data it has not sent.

foreign: host/hvf.c, host/hvf.js

effect Hvf.udp_flows source · line 469 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fdc_stamps source · line 473 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fdc_put source · line 477 · raw

@slot:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.udp_send source · line 481 · raw

@flow:U32 -> @sport:U32 -> @ip:U32 -> @port:U32 -> @bytes:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.udp_recv source · line 485 · raw

@flow:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.share_open source · line 490 · raw

@path:String -> IO(U32)

Shared directories for virtio-9p (host/fs.bend wraps these).

foreign: host/hvf.c, host/hvf.js

effect Hvf.fs source · line 494 · raw

@share:U32 -> @op:U32 -> @path:String -> @path2:String -> @a_hi:U32 -> @a_lo:U32 -> @b:U32 -> @bytes:List<&2, U32> -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.pause source · line 499 · raw

IO(U32)

Pause, snapshots and restore (host/hvf.c).

foreign: host/hvf.c, host/hvf.js

effect Hvf.resume source · line 503 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.exit_counts source · line 509 · raw

IO(List<&2, U32>)

Exits so far, per vCPU: [cpu, n, n pairs of (bucket, count)] (Ctl.exit_name names a bucket).

foreign: host/hvf.c, host/hvf.js

effect Hvf.pause_state source · line 513 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_save source · line 517 · raw

@words:List<&2, U32> -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_commit source · line 521 · raw

@path:String -> @plan:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_rebase source · line 525 · raw

@path:String -> @off_hi:U32 -> @off_lo:U32 -> @private:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.hib_update source · line 529 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.hib_mark source · line 533 · raw

@op:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.lan_open source · line 537 · raw

@dir:String -> @name:String -> @mode:U32 -> @replace:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.lan_send source · line 541 · raw

@name:String -> @iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.lan_names source · line 545 · raw

IO(List<&1, String>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.lan_recv source · line 549 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.lan_to_ram source · line 553 · raw

@iovs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.lan_release source · line 557 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.set_prog source · line 561 · raw

@n:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.prog source · line 565 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.net_limits source · line 569 · raw

@words:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.rename source · line 573 · raw

@from:String -> @to:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.sock_facts source · line 577 · raw

@path:String -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.sock_remove source · line 581 · raw

@path:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.mkdir source · line 585 · raw

@path:String -> @mode:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.dir_facts source · line 589 · raw

@path:String -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_plans source · line 593 · raw

@gic:List<&2, U32> -> @regs:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_drop source · line 597 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_peek source · line 601 · raw

@off_hi:U32 -> @off_lo:U32 -> @len:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_load source · line 605 · raw

@layout:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_open source · line 609 · raw

@path:String -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_info source · line 613 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_args source · line 617 · raw

IO(List<&1, String>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_machine source · line 621 · raw

IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.snap_gic source · line 625 · raw

IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ctl_listen source · line 630 · raw

@path:String -> @mode:U32 -> @backlog:U32 -> IO(U32)

The control socket (host/hvf.c).

foreign: host/hvf.c, host/hvf.js

effect Hvf.ctl_next source · line 634 · raw

@deadline_ms:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.ctl_reply source · line 638 · raw

@text:String -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.unix_connect source · line 644 · raw

@key:U32 -> @path:String -> IO(U32)

vsock over Unix sockets (host/hvf.c). Sockets share the tcp_* table under the key conn XOR 0x40000000.

foreign: host/hvf.c, host/hvf.js

effect Hvf.vsock_listen source · line 648 · raw

@path:String -> @mode:U32 -> @backlog:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.vsock_base source · line 652 · raw

IO(String)

foreign: host/hvf.c, host/hvf.js

effect Hvf.vsock_file source · line 656 · raw

@ok:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.vsock_accept source · line 660 · raw

@deadline_ms:U32 -> IO(List<&2, U32>)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fwd_listen source · line 666 · raw

@idx:U32 -> @addr:String -> @port:U32 -> @backlog:U32 -> IO(U32)

Port forwarding (host/hvf.c): forward idx listens on addr:port; each accepted client is a NAT connection, its id fresh (0x20000000 up).

foreign: host/hvf.c, host/hvf.js

effect Hvf.fwd_accept source · line 670 · raw

@idx:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.err_text source · line 675 · raw

@code:U32 -> IO(String)

An errno's message (strerror).

foreign: host/hvf.c, host/hvf.js

effect Hvf.fw_load source · line 680 · raw

@code:String -> @vars:String -> IO(U32)

UEFI flash (host/hvf.c): the firmware and variable banks.

foreign: host/hvf.c, host/hvf.js

effect Hvf.flash source · line 684 · raw

@op:U32 -> @a:U32 -> @b:U32 -> @bytes:List<&2, U32> -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fb_init source · line 689 · raw

@width:U32 -> @height:U32 -> IO(U32)

The framebuffer and its window (host/hvf.c).

foreign: host/hvf.c, host/hvf.js

effect Hvf.fb_dump source · line 693 · raw

@path:String -> @mode:U32 -> IO(U32)

foreign: host/hvf.c, host/hvf.js

effect Hvf.fb_present source · line 697 · raw

@window:Window -> IO(Pair(Window, List<&1, Event>))

foreign: host/hvf.c, host/hvf.js