~/bend-docscommunity

src/virtio/console.bend checks

raw source on the hub · import 0x4c3545aa4609661612fe35675effd0c0/src/virtio/console.bend as Console

4 imports
import Base
import ../lib/u64.bend as U
import ../vmm/abi.bend as V
import ./queue.bend as Q

Types

type ConTx source · line 12 · raw

Data

What a transmit pass produced.

type ConRx source · line 16 · raw

Data

What a receive pass did with the pending input.

Definitions

def Con.max_tx source · line 21 · raw

U32

The most bytes one transmit chain hands over: the rest of a longer chain is dropped (a guest length must not size a Bend list).

def Con.tx.serve source · line 26 · raw

@-R:Type -> @q:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq -> @c:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Chain -> @acc:List<&2, List<&2, U32>> -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, List<&2, List<&2, U32>>)>

Gathers one transmit chain (at most Con.max_tx() bytes) and pushes it used with length 0; prepends its bytes to acc (newest chain first).

def Con.tx.done source · line 36 · raw

@-R:Type -> @q:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq -> @acc:List<&2, List<&2, U32>> -> @used:Bool -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConTx>

def Con.tx.step source · line 41 · raw

@-R:Type -> @r:Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, Maybe<&2, 0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Chain>) -> @acc:List<&2, List<&2, U32>> -> @used:Bool -> @k:(@_:Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, List<&2, List<&2, U32>>) -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConTx>) -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConTx>

After a pop: stops on an empty queue, else serves the chain and continues with k.

def Con.tx.go source · line 53 · raw

@fuel:Nat -> @-R:Type -> @st:Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, List<&2, List<&2, U32>>) -> @used:Bool -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConTx>

Pops and serves transmit chains, at most fuel of them; st is the queue and the chains' bytes so far (newest first).

def Con.tx source · line 69 · raw

@-R:Type -> @q:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConTx>

Takes every available chain of transmitq0 (at most num): gathers its readable bytes, in chain order, and pushes it used with length 0. Answers the queue, all bytes in order, and whether any chain was used.

def Con.rx.serve source · line 76 · raw

@-R:Type -> @q:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq -> @c:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Chain -> @+input:List<&2, U32> -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, List<&2, U32>)>

Scatters input over one receive chain's writable descriptors, pushes it used with the count that fit, and answers the queue and the bytes left.

def Con.rx.step source · line 88 · raw

@-R:Type -> @r:Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, Maybe<&2, 0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Chain>) -> @input:List<&2, U32> -> @used:Bool -> @k:(@_:Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, List<&2, U32>) -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConRx>) -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConRx>

After a pop: stops on an empty queue with the input left, else serves the chain and continues with k.

def Con.rx.go source · line 100 · raw

@fuel:Nat -> @-R:Type -> @st:Pair(0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq, List<&2, U32>) -> @used:Bool -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConRx>

Pops and fills receive chains, at most fuel of them, while input remains; st is the queue and the input left.

def Con.rx source · line 119 · raw

@-R:Type -> @q:0x4c3545aa4609661612fe35675effd0c0/src/virtio/queue.Vq -> @input:List<&2, U32> -> 0x4c3545aa4609661612fe35675effd0c0/src/vmm/abi.Op<R, ConRx>

Delivers pending input into receiveq0: each available chain (at most num) takes as many bytes as its writable descriptors hold, pushed used with that length, until the input runs out (an empty input pops nothing). Answers the queue, the bytes that did not fit, and whether any chain was used.