Skip to main content

Module layout

Module layout 

Source
Expand description

Cap-index convention for transpiler-emitted Images.

The geometry of a linked program — which data regions exist, how many pages each occupies, and where they land in the guest address space — belongs to [nub_program::Regions] and is decided by the linker. What lives here is the one thing that is genuinely a JAVM choice: which cnode slot each region’s Cap::Data is filed under.

Slots 65..68 are arbitrary but fixed. They sit above the low slots a guest’s own cnode uses, and the runtime resolves each Image MemoryMapping’s source path through them.

Constants§

CODE_BASE
Re-exported PVM2 ABI layout constants (see [nub_program::abi]). Guest virtual address where the (single) code region maps read-only. A PVM PC is CODE_BASE + byte_offset. Sits at 4 MiB so [0, 4 MiB) is an unmapped null guard.
DATA_BASE
Re-exported PVM2 ABI layout constants (see [nub_program::abi]). Guest virtual address where the data region begins. All data regions (stack / ro / rw / heap) and instance overlays live in [DATA_BASE, 4 GiB). At 256 MiB, well clear of the largest permitted code region.
HEAP_CAP_INDEX
Cap index of the heap DATA cap.
MAX_CODE_SIZE
Re-exported PVM2 ABI layout constants (see [nub_program::abi]). Maximum byte length of the code region. Code occupies [CODE_BASE, CODE_BASE + code_len) and must stay below DATA_BASE, so code_len ≤ DATA_BASE − CODE_BASE = 252 MiB.
PVM_PAGE_SIZE
PVM page size in bytes. PVM page size in bytes. Every region is a whole number of pages.
RO_CAP_INDEX
Cap index of the read-only DATA cap (.rodata).
RW_CAP_INDEX
Cap index of the read-write DATA cap (.data + .bss).
STACK_CAP_INDEX
Cap index of the stack DATA cap.

Functions§

cap_index
The cnode slot a region’s Cap::Data is filed under.