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, 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§

DataCapEntry
One DATA cap’s layout: where it lives in the manifest, where it maps in guest memory, and at what access mode.
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_CAP_INDEX
Cap index of the CODE cap in transpiler-emitted blobs. Matches the JAR init_cap field.
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.