Skip to content

0.29.6: optional interfaces asked at run time; the PE rows by their container; the i386 record and DOS (technical experiment) - #95

Merged
Sunrisepeak merged 7 commits into
mainfrom
feat/0.29.6-optional-interfaces
Nov 14, 2026
Merged

Sunrisepeak merged 7 commits into
mainfrom
feat/0.29.6-optional-interfaces

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

In an ok image openkal.fs, openkal.process and openkal.task are asked at run time (OKM_HAS_<X>=2, port/src/okm_opt.h). Each name is imported weakly (SPEC 12.4); a call reaches it where it is bound and the answer of the build without the interface where it is not.

  • The image's requirements name only what it calls unconditionally. An import std image that uses neither files nor processes nor threads requires openkal.abort, openkal.env, openkal.memory, openkal.stream and openkal.time (with openkal-llvm-runtime 0.20.3): 21 strong imports, 84 weak, measured on x86_64.
  • Without openkal.region the allocator's memory is backed at once, so an arena is 16 MiB rather than a gibibyte.
  • The PE rows are selected by their container (Windows, UEFI), and the optional interfaces by the implementation's statement.
  • Libraries built for a known implementation are unchanged.

i386 and DOS

  • The i386 record of a triple with no system serves the i686-openkal ok image (ELF32 with REL relocations, linked with -z rela).
  • DOS (technical experiment only): i686-dos-musl is openkal-musl over openkal-dos, standalone, under a DPMI host (CWSDPMI).
  • The context table's hash is 64 bits on every word. On a 32-bit word the previous form shifted by 32, which is undefined; optimised i386 builds ended before main with status 1.

Verified

  • The image runs under okrun on Linux, and under an okrun carrier on UEFI firmware (OVMF, QEMU q35) above an implementation without files, processes or threads, with an exception, std::map, std::format and a vector: status 42.
  • An i686-openkal image runs under an okrun built for i686-linux-musl in dev and release: status 7.
  • An i686-dos-musl program runs under DOSBox Staging in dev and release: status 7. The i386 image, carried as a DOS program, also returns 7.

In an ok image openkal.fs, openkal.process and openkal.task are asked at run
time (OKM_HAS_<X>=2): each name is imported weakly (SPEC 12.4), and a call
reaches it where it is bound and the answer of the build without the interface
where it is not. The image's requirements then name only what it calls
unconditionally, so an image runs on an implementation without files,
processes or threads, a firmware among them. Without openkal.region the
allocator's memory is backed at once, and an arena is 16 MiB rather than a
gibibyte. Libraries built for a known implementation are unchanged.
…interfaces from the implementation's statement
@Sunrisepeak Sunrisepeak changed the title 0.29.6: an image asks for its optional interfaces at run time 0.29.6: optional interfaces asked at run time or taken from the implementation; the PE rows by their container (UEFI) Nov 13, 2026
…32 MiB arenas and passes its alignment

Measured under OVMF: mimalloc's page map was the firmware pool's fill
pattern (a reservation read as zero on first commit), and a carried image's
allocator could not reserve a second 256 MiB arena, nor over-allocate one.
A reservation is now cleared when made, an arena is 32 MiB where memory is
backed at once (MIMALLOC_ARENA_RESERVE is kept), and the alignment mimalloc
states is passed to kal_alloc and recorded for kal_free.
…one; the i386 record of a triple with no system
@Sunrisepeak
Sunrisepeak force-pushed the feat/0.29.6-optional-interfaces branch from cdea179 to 33da3af Compare November 13, 2026 16:57
start_at multiplied in kal_uintptr and shifted by thirty-two, which is undefined where the word is thirty-two bits (i386). An unoptimised build's shift left the word as it was; an optimised one's index was anything, so an i686-dos-musl program built for release ended before main (measured: status 1 under DOSBox Staging, 7 unoptimised). The product is taken in uint64_t; where the word is sixty-four bits the value is the one it always was.
@Sunrisepeak Sunrisepeak changed the title 0.29.6: optional interfaces asked at run time or taken from the implementation; the PE rows by their container (UEFI) 0.29.6: optional interfaces asked at run time; the PE rows by their container; the i386 record and DOS (technical experiment) Nov 13, 2026
@Sunrisepeak
Sunrisepeak merged commit 5dfc004 into main Nov 14, 2026
25 of 30 checks passed
@Sunrisepeak
Sunrisepeak deleted the feat/0.29.6-optional-interfaces branch November 14, 2026 15:15
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