Skip to content

0.6.3: a core runner for an implementation without files, processes or threads; i386 images - #39

Merged
Sunrisepeak merged 6 commits into
mainfrom
feat/0.6.3-core-runner
Nov 14, 2026
Merged

Sunrisepeak merged 6 commits into
mainfrom
feat/0.6.3-core-runner

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

One interface (include/okrun.h, run/src/runner.h, the bindings) has two runners. run/mcpp.toml selects one by the interfaces the implementation provides, with cfg(interface = "openkal.fs") (mcpp 2026.11.13.1, a general layer key answered from [kernel-abi] provides-interfaces). No implementation is named and no file is guarded by a macro.

  • With openkal.fs, openkal.process, openkal.task, openkal.random and openkal.map: the full runner (run/src/full), unchanged.
  • Without any of them: the core runner (run/src/core). What the program carries runs from memory (okrun_run_bytes, okrun_run_images, okrun_run_okb_bytes) with the same admission (requirements note, architecture, signature) and the same loader. It has no cache, snapshot or profiler; okrun_run_file refuses with the reason.
  • A callback of an absent interface is absent, as its other names are, so an image that imports it weakly runs (SPEC 12.4).
  • openkal-run requires only openkal.abort, openkal.env, openkal.exec, openkal.memory, openkal.stream and openkal.time, and mcpp >= 2026.11.13.1.
  • ld, run and tools move together to 0.6.3.

i386 images (ELFCLASS32, EM_386; openkal 0.25.1, clauses 5.5 and 12.2):

  • libokld widens an ELF32 header, program headers and dynamic table into the sixty-four bit forms, and reads symbols and relocations through class accessors. One reader, checker, placement and loader serve both classes. RELR uses the four-byte word (a 31-entry bitmap), and the GNU hash bloom uses four-byte words.
  • An image states its addends (RELA, -z rela); a REL image is refused, with that option named. The loader applies R_386_RELATIVE, R_386_32, R_386_GLOB_DAT and R_386_JMP_SLOT.
  • The runner enters an i386 image and its callbacks in the System V i386 convention, with x87 0x037F, and with MXCSR 0x1F80 where CPUID (asked once) reports SSE. okb names the architecture i686.
  • The debugger object is of the image's class. i386's retained REL relocations keep their addend in the word, so each R_386_32/R_386_PC32 word is rewritten to that addend. A new builder case covers this; builder 65 and loader 9 pass under ASan/UBSan/LSan.
  • CI builds, places, checks and bundles i386 images. examples/build-image.sh takes i686, and states addends for every architecture.

Verified locally with the mcpp branch:

  • ld tests pass.

  • The full okrun runs an import std image (exception, map, format, vector) from a file on Linux x86_64, status 42; --prof=calls also gives 42.

  • A UEFI carrier selects the core runner above openkal-uefi 0.10.0 and runs the same image under OVMF (QEMU q35) through dirun, status 42.

  • An i686-openkal image (C++23, import std, exception) runs under an okrun built for i686-linux-musl on x86_64 Linux, status 7; gdb stops at a source line of it and unwinds into the runner. The examples hello (contexts with emulated TLS), needed (an .okso) and an okb of x86_64 + i686 run there too.

CI runs against the mcpp branch (MCPP_SOURCE_REF) until 2026.11.13.1 is released.

@Sunrisepeak
Sunrisepeak force-pushed the feat/0.6.3-core-runner branch from b4b2ecd to ba5865e Compare November 13, 2026 08:57
…r threads

One interface (include/okrun.h, run/src/runner.h, the bindings) has two
runners, selected in run/mcpp.toml by the interfaces the implementation
provides (cfg(interface = ...), mcpp 2026.11.13.1). With openkal.fs,
openkal.process, openkal.task, openkal.random and openkal.map it is the full
runner (run/src/full), unchanged. Without any of them it is the core runner
(run/src/core), which runs what the program carries from memory --- an image,
a group, or an archive --- with the same admission and loader, and without
cache, snapshot or profiler; okrun_run_file refuses with the reason. A callback
of an absent interface is absent, as its other names are. openkal-run requires
only abort, env, exec, memory, stream and time.
@Sunrisepeak
Sunrisepeak force-pushed the feat/0.6.3-core-runner branch from ba5865e to f0c2510 Compare November 13, 2026 11:36
…bugged

libokld opens an image of either class. A view widens an ELF32 header,
program headers and dynamic table into the sixty-four bit forms, and reads
symbols and relocations through accessors of the class; the bloom filter,
packed relative relocations (a bitmap of 31 entries) and the word a
relocation writes follow the class. An i386 image states its addends (RELA,
`-z rela`); a REL image is refused with that option named. The relocations
applied are R_386_RELATIVE, R_386_32, R_386_GLOB_DAT and R_386_JMP_SLOT.

The runner enters an i386 image and its callbacks in the System V i386
convention (SPEC 12.2), with the x87 control word 0x037F and MXCSR 0x1F80
where the processor has SSE, asked once by CPUID. okb names the
architecture i686. The debugger object is of the image's class: i386's
retained REL relocations carry their addend in the word, so the object
holds each R_386_32 and R_386_PC32 word less the resolved value.

Measured: an i686-openkal image (C++23, import std, an exception across a
frame) runs under okrun built for i686-linux-musl on x86-64 Linux, and gdb
stops at a source line of it and unwinds into the runner.
@Sunrisepeak Sunrisepeak changed the title 0.6.3: a core runner for an implementation without files, processes or threads 0.6.3: a core runner for an implementation without files, processes or threads; i386 images Nov 13, 2026
@Sunrisepeak
Sunrisepeak merged commit 76082cc into main Nov 14, 2026
6 checks passed
@Sunrisepeak
Sunrisepeak deleted the feat/0.6.3-core-runner branch November 14, 2026 14:57
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