Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Boot Initialisation: the microkit.init Process and Mapping Symbols

Boot-time behaviour of a protection domain is expressed in two ways:

  1. Address binding is automatic: every Mapping exports its addresses to the imported C implementation through a naming convention (the mapping symbols below). No syntax is required.
  2. Boot-time logic is modelled by an ordinary process bound to the platform’s boot entry point with @bind(microkit.init) — the model-level counterpart of Microkit’s void init(void) entrypoint, which fic generates.

The boot process

The boot process is the one annotated @bind(microkit.init). Its name carries no meaning — Init is a common choice, but the binding, not the name, is what makes it the boot entry point:

@bind(microkit.init)
proc Init() {
    setup_eth -> Skip;
}

Microkit calls the PD’s entrypoint exactly once, before any event is delivered, so the bound process must not contain channel receives or IRQ awaits; fic does not check this. When it terminates (Skip), control falls through to the @bind(microkit.notified) event loop — exactly as the generated C init() runs the boot body and then arms notified().

A @bind(microkit.init) process is mandatory for every PD that has a .fi program when targeting Microkit (--emit=c or image generation): the kernel calls init() on every PD at startup. It is mandatory in tandem with @bind(microkit.notified) — Microkit invokes both, so a conforming PD binds both (any other platform entry points are optional). A PD with no boot work still declares a no-op:

@bind(microkit.init)
proc Init() { Skip; }

The @bind(microkit.notified) process, in turn, should be receive-headed if it receives at all (a warning otherwise); see Annotations. That both are bound is checked in every mode, --emit=xta included; see Entry Points.

Mapping symbols

For every mapping named m, the generated C of the protection domain has these symbols:

SymbolTypeValue
m_vaddruintptr_tVirtual address of the mapping, defined with the address fic laid out (or the one pinned).
m_sizeuint64_tRegion size in bytes, defined with its value.
m_paddruintptr_tPhysical address of the backing region. Declared only in a PD whose program reads m.paddr, and patched by the Microkit loader (a setvar in the SDF) before the PD starts.

fic defines them; the imported C declares the ones it uses extern:

import "include/eth.h" as eth;

Low Mapping ring_buffer(ring_buffer_outer, "rw");
Low Mapping packet_buffer(packet_buffer_outer, "rw");
/* src/eth.c: defined by the generated C, not here */
extern uintptr_t ring_buffer_vaddr;    /* ring_buffer.vaddr   */
extern uintptr_t packet_buffer_vaddr;  /* packet_buffer.vaddr */
extern uint64_t  packet_buffer_size;

Pick mapping names so that <mapping>_vaddr matches the symbol your implementation uses. A channel’s buffer region has no such symbols: only fic’s runtime reaches it.

Validation

  • Mapping names must be unique within a PD (checked by name resolution); this also guarantees the derived symbols are unique.
  • m_paddr exists only where m.paddr is read: see A mapping’s addresses.