Skip to content

0.4.0 --- openkal 0.23: an image at a base of each boot, its touch note, a snapshot of its initialisers, and the runner's measurement and debugging - #21

Merged
Sunrisepeak merged 9 commits into
mainfrom
openkal-0.23
Nov 3, 2026
Merged

Sunrisepeak merged 9 commits into
mainfrom
openkal-0.23

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

openkal-image 0.4.0 (openkal-ld, openkal-run, openkal-tools) for openkal 0.23 (mcpplibs/openkal, branch openkal-0.23; mcpp design 2026-11-03, part 4).

An image at its base. okld place writes the placement note (SPEC 12.4, type 3); the loader reserves the span at a base (kal_exec_alloc_at), takes the stored data and applies only the relocations naming a symbol. Read-only-after-relocation blocks no such relocation writes are the file's pages; the range is sealed once relocated (kal_exec_seal_part, for good for an image never unloaded). The data is mapped privately from the file (KAL_EXEC_MAP_WRITE).

A base for each boot. A slide chosen once per user and boot moves the image from the base of its digest; the first start writes the data for that base as a prepared copy (type 5, <digest>-<base>.okseg) in the user's cache, later starts map it, and a new boot removes it. OKRUN_PLACE=sealed and OKRUN_PLACE=0 keep the sealed base or place anywhere.

The touch note (type 4): okprof record --what touch records first executions through kal_prof_touch_*; okld touch writes the note; the loader reads noted runs in (KAL_EXEC_MAP_PREFETCH) by the program's resource preference; okprof report --order writes a symbol ordering file.

A snapshot of the initialisers (docs/snapshot.md): the runner makes one once a boot in a runner it starts again (OKRUN_SNAPSHOT=start/make), binding the image to memory, the implementation's facts and recorded answers (processors, cores, resource preference, named values) and refusing everything else; a proof holds that no word but an import's slot is a binding's address; a start maps the copy, applies the import relocations again and enters __okrun_snapshot_start. okld_bound_imports, OKLD_PREPARED_MAX.

Measurement and debugging: phases, samples (the implementation's sampler), touch, names (recorded grants); okprof report --flame / --format=trace / --order / --names; okgdb.py, oklldb.py and okld debug-split; a perfect hash for okrun_resolve; okprof and the scripts released beside okrun and okld.

What a start spends (the program's resource preference, kal_env_resources): performance reads the noted runs and the data ahead (prefetch level 2), balanced reads the noted runs (level 1), economy computes the placement's data in memory, makes no snapshot and reads nothing ahead; balanced is taken as economy when available memory is under 15 % or the cache's device has under 1 GiB free. OKRUN_PREFETCH=0|touch|all states the level. Snapshots are bounded (2 GiB for performance, 512 MiB otherwise) and the least recently used is removed first. okrun cache [list|gc [--all]] lists and reclaims what the runner keeps.

A compressed okb (okb 2, docs/okb.md §5): okld bundle --compress stores the images with DEFLATE (method 8), the manifest and the signature stored; the runner expands a member once into its cache (okrun/expanded) and maps it from there; okld_inflate is libokld's own freestanding reader. mcpp pack --pkg-format okb --compress gzip reaches it through MCPP_PACK_COMPRESS.

The runner's choices in the report: a runner array (point, outcome, bytes) states whether the placement, the snapshot and the expansion were used, made or declined, and why.

CI: the placement step covers this boot's base, the sealed base, anywhere and unplaced; a snapshot step covers made, used, declined by a changed named value and by OKRUN_SNAPSHOT=0, and refused for an initialiser that asks for the time; a compressed okb is built, checked and run; an economy start writes nothing to the cache. It resolves openkal 0.23 and its implementations from the index, so it runs after they are released.

Sunrisepeak and others added 9 commits November 3, 2026 03:51
… loader that applies only the relocations naming a symbol (openkal 0.23)

`okld place` chooses a base from the image's bytes, computes each writable
segment with a file part for it (RELA's and RELR's relative relocations
applied), appends them at offsets congruent to their addresses modulo 64 KiB
and fills the placement note (SPEC 12.4, type 3; format 1.1). Where the
implementation reports KAL_EXEC_PROP_PLACE, libokld reserves the image at
that base (okld_host::reserve_at, kal_exec_alloc_at), takes the stored
segments, maps each 64 KiB of PT_GNU_RELRO no symbol relocation writes from
the file, and applies only the relocations naming a symbol; otherwise it
relocates as before. okrun sets reserve_at (OKRUN_PLACE=0 declines it).
`okld check` holds a placement to the image; `okld place` refuses a signed
image. build-image.sh packs relative relocations and places every image.

Over openkal 0.23.0 (openkal-linux 0.24.0, openkal-macos 0.21.0,
openkal-windows 0.19.0).

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
…ebugger scripts

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
… the placement's data in memory for economy, the snapshots' bound), okrun cache, a compressed okb (okb 2) expanded into the cache, the runner's choices in a report

Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
@Sunrisepeak
Sunrisepeak merged commit 8c4438f into main Nov 3, 2026
5 checks passed
@Sunrisepeak
Sunrisepeak deleted the openkal-0.23 branch November 3, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant