Skip to main content

Module os

Module os 

Source
Expand description

OS memory layer over crate::prim (mirrors upstream src/os.c).

Adds to prim: cached configuration, page-size rounding, alignment validation, and the purge policy (decommit vs reset — mi_option_purge_decommits, wired to the options table in M7; until then callers pass the policy).

Structs§

OsBlock
A block of OS memory returned by alloc_aligned.

Functions§

alloc_aligned
Reserve (and optionally commit) an aligned block of OS memory.
alloc_granularity
Reservation granularity (64 KiB on Windows, page size elsewhere; cached).
commit
Commit a page-aligned sub-range of a reserved block. Returns known-zero.
decommit
Decommit a page-aligned sub-range. Returns whether recommit is required.
free
Release a block from alloc_aligned.
large_page_size
Large-page size, 0 when unavailable (cached).
page_align_up
Round size up to a whole number of OS pages (never 0).
page_size
OS page size (cached).
protect
Toggle no-access protection on a page-aligned range (guard pages).
purge
Purge a range per policy: purge_decommits → decommit (returns whether recommit is needed); otherwise reset (stays committed, contents undefined).