Skip to main content

Module layout

Module layout 

Source
Expand description

Shared program data-region layout for transpiler-emitted Images.

ProgramLayout assigns cap_index, base_page, and page_count to each DATA cap appearing in a transpiler-emitted Image. The consumer is crate::linker::link_elf, which uses ProgramLayout::stack_top to compute the initial SP value baked into every endpoint’s [javm_cap::image::EndpointDef::initial_regs]. The page-count and base-page metadata also feed declarative Image.memory_mappings.

Cap-index convention: 65 = stack, 66 = ro, 67 = rw, 68 = heap. Code is not a cap — it is the Image’s dedicated code field mapped read-only at CODE_BASE. Data is laid out from javm_cap::layout::DATA_BASE (256 MiB) upward and stacks linearly: stack lives at [DATA_BASE, DATA_BASE + stack_pages), ro at [DATA_BASE + stack_pages, …), etc.

Structs§

DataCapEntry
One DATA cap’s layout: where it lives in the manifest and where it maps in guest memory.
ProgramLayout
Full DATA-cap layout of a transpiler-emitted blob. stack is always present; ro, rw, heap are present only when their page count is non-zero. Args bytes are delivered separately (kernel-allocated cap at bare-Frame slot 4), so they are not part of the layout.

Constants§

CODE_BASE
Guest virtual address where the code region is mapped read-only.
DATA_BASE
Re-exported PVM2 ABI layout constants (see [javm_cap::layout]). Guest virtual address where the data region begins. All data caps (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 [javm_cap::layout]). 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.
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.