Skip to main content

Module layout

Module layout 

Source
Expand description

PVM2 guest virtual-address-space layout (ABI constants).

These are re-exports of [nub_program::abi], which owns them: they are PVM2 ISA/ABI facts, not capability facts, and every producer and consumer of a PVM2 program must agree on them whether or not a capability system is involved.

They remain re-exported here because javm_cap::layout::DATA_BASE is the spelling used across the JAVM runtimes, and because an Image is laid out against exactly these constants:

  [0,         CODE_BASE)  unmapped — NULL guard (catch PC=0 / null deref)
  [CODE_BASE, DATA_BASE)  CODE     — RO, ≤ MAX_CODE_SIZE bytes
  [DATA_BASE, 4 GiB)      DATA     — stack / ro / rw / heap, RO|RW

Code placement is a fixed protocol constant rather than an Image-supplied mapping entry: an untrusted Image must not get to choose where its code lands.

Constants§

CODE_BASE
Guest virtual address where the (single) code region maps read-only. A PVM PC is CODE_BASE + byte_offset. Sits at 4 MiB so [0, 4 MiB) is an unmapped null guard.
DATA_BASE
Guest virtual address where the data region begins. All data regions (stack / ro / rw / heap) and instance overlays live in [DATA_BASE, 4 GiB). At 256 MiB, well clear of the largest permitted code region.
MAX_CODE_SIZE
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.