Expand description
Shared program data-region layout for transpiler-emitted Images.
ProgramLayout assigns cap_index, base_page, page_count,
and access to each DATA cap appearing in a transpiler-emitted
Image. Today the only 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 will also feed declarative
Image.memory_mappings once the kernel honors them at instance
init (future work).
Cap-index convention: 64 = CODE, 65 = stack, 66 = ro, 67 = rw,
68 = heap. Address layout starts at page 0 and stacks linearly:
stack lives at [0, stack_pages), ro at [stack_pages, stack_pages + ro_pages), etc.
Structs§
- Data
CapEntry - One DATA cap’s layout: where it lives in the manifest, where it maps in guest memory, and at what access mode.
- 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_
CAP_ INDEX - Cap index of the CODE cap in transpiler-emitted blobs. Matches the
JAR
init_capfield. - HEAP_
CAP_ INDEX - Cap index of the heap DATA cap.
- 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.