Memory Region Declarations
MemoryRegionDecl ::= SecurityLabel? 'MemoryRegion' ident '(' size (',' page_size?)? (',' phys_addr)? ')' ';'
size ::= hex
page_size ::= hex // '0x1000' (4 KiB) | '0x200000' (2 MiB)
phys_addr ::= hex
SecurityLabel ::= 'High' | 'Low'
A memory region declaration introduces one named region of physical or
virtual memory that protection domains can later map into their
address space. MemoryRegion declarations live in .fis system files;
they are pure topology and carry no per-PD program logic.
Fields
- Security label (optional, defaults to
Low). Tags information-flow level. The one rule is on mappings: a mapping’s label must be at least its region’s, so aHighregion is never mapped atLow; protection domains carry no labels. See Information-flow labels; the Information Flow chapter covers the check. - Name —
snake_caseidentifier; the same name is referenced fromMappingdeclarations in.fifiles. - Size — required, hex literal, in bytes. Must be a multiple of the region’s page size; the parser rejects a size that is not.
- Page size — optional, defaults to
0x1000(4 KiB). The other accepted value is0x200000(2 MiB / Large). The slot may be left empty to give a physical address alone (MemoryRegion mmio(0x1000, , 0xfe000000);), and any other value is not an error: it silently falls back to 4 KiB, so a mistyped page size changes which alignment is checked. - Physical address — optional. When present, must be aligned to the region’s page size. Used for device MMIO regions (clock controller, ethernet registers) where the seL4 loader maps a fixed physical frame rather than allocating one.
Security label and ordering
The label, if present, comes before the MemoryRegion keyword. Omitting
it is equivalent to writing Low:
MemoryRegion ring_buffer_outer(0x1000, 0x1000); // Low (default)
Low MemoryRegion eth0(0x10000, 0x1000, 0x5b040000); // explicit Low
High MemoryRegion ring_buffer_inner(0x1000, 0x1000); // High
High MemoryRegion eth_clk(0x1000, 0x1000, 0x5b200000); // High MMIO
Validation
Two checks run in the parser, each reported at the declaration:
sizeis a multiple ofpage_size.phys_addr(if present) is aligned topage_size.
Resolution then checks that the region name is unique within the system
file. A region is referenced from .fi files by its name; the validator confirms
each Mapping’s mem_region points at a declared MemoryRegion.
Channel buffers
A region named in a channel’s via clause is a
channel buffer. It is mapped into both endpoint PDs implicitly, backs one
channel only, and must not also appear in an explicit Mapping; each of
these is an error otherwise. Any other region may be mapped by several PDs.
Examples
// Anonymous shared buffer, default 4 KiB page, allocator-assigned phys_addr.
MemoryRegion ring_buffer_outer(0x1000, 0x1000);
// 2 MiB region — large pages, allocator-assigned phys_addr.
MemoryRegion packet_buffer_outer(0x200000, 0x200000);
// Memory-mapped device (4 KiB MMIO, fixed physical address).
Low MemoryRegion eth_outer_register(0x1000, 0x1000, 0xf000000);
// 64 KiB device register window, in 4 KiB pages.
Low MemoryRegion eth0(0x10000, 0x1000, 0x5b040000);
// High-side region (a `Low` mapping of it is rejected by the
// information-flow check).
High MemoryRegion eth_clk(0x1000, 0x1000, 0x5b200000);