~/bend-docscommunity

src/vmm/layout.bend checks

raw source on the hub · import 0x81011db9256231154e908712080eb16d/src/vmm/layout.bend as Layout

2 imports
import Base
import ../lib/u64.bend as U

Types

type Region source · line 93 · raw

Data

A device region: [base, base+size) belongs to device number dev.

type Hit source · line 97 · raw

Data

Where an address landed: the device and the offset inside its region.

Definitions

def Layout.gicd_base source · line 24 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

def Layout.gicr_base source · line 27 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

def Layout.gicr_region_size source · line 31 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

Size of the redistributor region Hypervisor.framework reserves (32 MiB).

def Layout.uart_base source · line 34 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

def Layout.uart_intid source · line 37 · raw

U32

def Layout.rtc_base source · line 41 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

PL031 RTC: 4 KiB at 0x0901_0000, SPI 2 (INTID 34).

def Layout.rtc_intid source · line 44 · raw

U32

def Layout.fb_base source · line 49 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

The framebuffer (--display): 16 MiB of host memory at 0x1000_0000, below RAM and clear of every device.

def Layout.fb_size source · line 52 · raw

U32

def Layout.flash0_base source · line 56 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

The two 64 MiB flash banks of a UEFI boot (--firmware).

def Layout.flash1_base source · line 59 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

def Layout.flash_size source · line 62 · raw

U32

def Layout.flash_fits source · line 68 · raw

@+size:U32 -> Bool

A firmware or variable store file of size bytes fits its flash bank (a larger one would be cut short; 4294967295 is a file the host could not size).

def Layout.virtio_base source · line 71 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

def Layout.virtio_slot_size source · line 74 · raw

U32

def Layout.virtio_slots source · line 77 · raw

U32

def Layout.ram_base source · line 80 · raw

0x81011db9256231154e908712080eb16d/src/lib/u64.U64

def Layout.virtio_slot source · line 84 · raw

@n:U32 -> 0x81011db9256231154e908712080eb16d/src/lib/u64.U64

Base address of virtio slot n.

def Layout.virtio_intid source · line 89 · raw

@n:U32 -> U32

INTID of virtio slot n.

def Bus.holds source · line 103 · raw

@+base:0x81011db9256231154e908712080eb16d/src/lib/u64.U64 -> @size:0x81011db9256231154e908712080eb16d/src/lib/u64.U64 -> @+addr:0x81011db9256231154e908712080eb16d/src/lib/u64.U64 -> Bool

True when addr lies in [base, base+size). The test compares the offset addr - base with size, so it needs no end address and holds for a region that ends at 2^64.

def Bus.hit source · line 107 · raw

@r:Region -> @+addr:0x81011db9256231154e908712080eb16d/src/lib/u64.U64 -> Maybe<&2, Hit>

Hit{dev, addr - base} when the region holds addr.

def Bus.find source · line 113 · raw

@regions:List<&2, Region> -> @+addr:0x81011db9256231154e908712080eb16d/src/lib/u64.U64 -> Maybe<&2, Hit>

The region holding addr, if any. When regions overlap, the first one wins.

def Bus.fits source · line 122 · raw

@r:Region -> Bool

True when the region ends at or below 2^64: size <= 2^64 - base, that is size - 1 <= not(base) for a non-empty region. An empty region never wraps.

def Bus.overlap source · line 129 · raw

@a:Region -> @b:Region -> Bool

True when two regions share an address. Two non-empty regions overlap iff one holds the base of the other; an empty region overlaps nothing.

def Bus.clear source · line 137 · raw

@+r:Region -> @rest:List<&2, Region> -> Bool

True when r overlaps no region of rest.

def Bus.disjoint source · line 145 · raw

@regions:List<&2, Region> -> Bool

True when no two regions overlap (and no region wraps past 2^64).