Skip to main content

Module program

Module program 

Source
Expand description

JAR program blob format — capability manifest.

The blob is a capability manifest: a list of initial capabilities (CODE and DATA) with their contents, plus invocation directives.

Layout:

Header:
  magic: u32              'JAR\x02'
  memory_pages: u32       total Untyped budget
  cap_count: u8           number of initial capabilities
  init_cap: u8            cap_index of the **initialize CODE cap**
                           run by Vault.initialize. The init program
                           is responsible for placing a callable-shaped
                           FrameRef at bare-Frame slot 4 before halting.

Capabilities[cap_count]:
  cap[i]: {
    cap_index: u8         slot in VM's cap table
    cap_type: u8          0 = CODE, 1 = DATA
    page_count: u32       number of pages (DATA only)
    data_offset: u32      offset into blob's data section
    data_len: u32         bytes of initial data (0 = zero-filled)
  }

Data section:
  (variable-length, referenced by capabilities)

In the v3 model the kernel will eventually consume Image.memory_mappings to set up DATA-cap mappings declaratively at instance init. Until that lands, transpiled chain Images carry an empty mapping list; the SP value baked into EndpointDef.initial_regs makes the metadata correct for when mappings come online.

Structs§

CapManifestEntry
A single capability entry in the manifest. DATA caps carry only (cap_index, page_count, data_offset, data_len); v3 chain Images will eventually express their data regions via Image.memory_mappings directly.
ParsedBlob
Parsed JAR blob.
ParsedCodeBlob
Parsed code sub-blob (within a CODE cap’s data section).
ProgramHeader
Parsed JAR header.

Enums§

Access
Memory-mapping access mode tracked by ProgramLayout for the stack / ro / rw / heap regions. Persistent mappings (declarative Image.memory_mappings) will translate this into the corresponding MappingSource::Persistent(...) entries.
CapEntryType
Cap type discriminator.

Constants§

JAR_MAGIC
JAR magic: ‘J’,‘A’,‘R’, 0x02.

Functions§

build_blob
Build a JAR blob from components.
build_simple_blob
Build a minimal JAR blob with a single CODE cap from raw components. Useful for tests — no DATA caps, small memory budget.
cap_data
Get the data slice for a capability entry from the data section.
parse_blob
Parse a JAR program blob.
parse_code_blob
Parse a CODE cap’s data section into jump table, code, and bitmask. Format: jump_len(4) + entry_size(1) + code_len(4) + jump_entries + code + packed_bitmask