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§
- Data
CapEntry - One DATA cap’s layout: where it lives in the manifest and where it maps in guest memory.
- Program
Layout - Full DATA-cap layout of a transpiler-emitted blob.
stackis always present;ro,rw,heapare 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 belowDATA_BASE, socode_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.