Skip to content

Commit f10baea

Browse files
authored
0.29.1: openkal-uefi 0.11.1 and openkal-dos 0.1.1, the DOS row's 1 MiB stack, ovmf 9.2.4-4, dirun 0.6.0 and freebsd-disk-image 14.5-1, mcpp.plugins 0.22.1 (#34)
* 0.29.1: openkal-uefi 0.11.1 and openkal-dos 0.1.1, the DOS row's 1 MiB stack, ovmf 9.2.4-4 and dirun 0.6.0, mcpp.plugins 0.22.0 * mcpp.plugins 0.22.1, whose mcpplibs.os accepts openkal 0.25 * FreeBSD runners: the disk images 14.5-1, whose profile runs the command where a run's files are
1 parent 6e0add0 commit f10baea

5 files changed

Lines changed: 67 additions & 28 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,10 @@ jobs:
355355
working-directory: checks/uefi
356356
run: |
357357
set +e
358-
mcpp run --release --target x86_64-uefi -- one "two three" | tee run.log
358+
mcpp run --release --target x86_64-uefi -- one "two three" "a b" | tee run.log
359359
status=${PIPESTATUS[0]}
360360
set -e
361-
grep -q 'uefi ok: \[1, 2, 3\] \["one", "two three"\]' run.log || { echo "::error::the application's output or arguments"; exit 1; }
361+
grep -q 'uefi ok: \[1, 2, 3\] \["one", "two three", "a b"\]' run.log || { echo "::error::the application's output or arguments"; exit 1; }
362362
[ "$status" -eq 42 ] || { echo "::error::the application returned $status, not 42"; exit 1; }
363363
p=$(find target/x86_64-uefi -path '*bin/uefi.efi' -type f | head -1)
364364
file "$p"
@@ -465,11 +465,24 @@ jobs:
465465
status=${PIPESTATUS[0]}
466466
set -e
467467
grep -q 'dos ok: \["one", "two"\]' run.log && grep -q 'caught: across a frame' run.log \
468+
&& grep -q 'deep: 2080' run.log \
468469
|| { echo "::error::the DOS program's output ($mode)"; exit 1; }
469470
[ "$status" -eq 7 ] || { echo "::error::the DOS program returned $status, not 7 ($mode)"; exit 1; }
470471
done
471472
p=$(find target/i686-dos-musl -path '*bin/dos.exe' -type f | head -1)
472473
file "$p"
474+
# The row's stack (0.29.1): the executable after the stub states 1 MiB in PT_GNU_STACK.
475+
python3 - "$p" <<'PY'
476+
import struct, sys
477+
data = open(sys.argv[1], "rb").read()
478+
at = data.find(b"\x7fELF\x01\x01")
479+
phoff, = struct.unpack_from("<I", data, at + 28)
480+
phentsize, phnum = struct.unpack_from("<HH", data, at + 42)
481+
sizes = [struct.unpack_from("<6I", data, at + phoff + i * phentsize)[5]
482+
for i in range(phnum) if struct.unpack_from("<I", data, at + phoff + i * phentsize)[0] == 0x6474E551]
483+
print("PT_GNU_STACK memsz:", sizes)
484+
sys.exit(0 if sizes == [1048576] else "::error::the DOS program states no 1 MiB stack")
485+
PY
473486
474487
- name: The i386 image carried as a DOS program
475488
working-directory: checks/i386

‎README.md‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,24 +165,28 @@ builds openkal-run's core runner as a program of the DOS row below, with the
165165
image in its `.oke` section. Measured under DOSBox Staging: the image sorted its
166166
arguments, caught its exception, read DOS's `PATH` and returned 7.
167167

168-
Platform 0.29.0 requires mcpp 2026.11.16.1. Every runner here that boots a
168+
Platform 0.29.0 and 0.29.1 require mcpp 2026.11.16.1. Every runner here that boots a
169169
machine is enabled on request: the UEFI row's (QEMU and OVMF), the DOS row's
170170
(DOSBox Staging), and, new, the hosted rows' runners on another system. FreeBSD
171-
programs run in the FreeBSD virtual machine of xim's disk image packages, and
171+
programs run in the FreeBSD virtual machine of xim's disk image packages (0.29.1:
172+
`freebsd-disk-image` 14.5-1, whose profile runs the command in the directory of
173+
the files a run delivers, `mcpp run --file`), and
172174
an `x86_64-windows-musl` program runs through Wine on an x86_64 Linux machine.
173175
Each fetches a machine image or an emulator, or makes a prefix in the home
174176
directory, on its first use, so `mcpp run` names the runner and how to enable it
175177
until a project or this machine does:
176178

177179
```toml
178180
[target.x86_64-freebsd-musl]
179-
platform = "openkal-platform@0.29.0"
181+
platform = "openkal-platform@0.29.1"
180182
runner = { enabled = true }
181183
```
182184

183-
The UEFI runner passes the program's arguments (`--`, with ovmf 9.2.4-3's Shell
184-
profile, whose arguments dirun 0.5.0 quotes for the Shell, so one with a blank
185-
arrives whole), and openkal-uefi 0.11.0 implements `openkal.fs` over the firmware's
185+
The UEFI runner passes the program's arguments (`--`, with ovmf 9.2.4-4's Shell
186+
profile, whose arguments dirun quotes for the Shell, so one with a blank arrives
187+
whole; openkal-uefi 0.11.1 divides them from the load options, so runs of blanks
188+
inside one are kept). The application's disk is a writable FAT32 image (dirun
189+
0.6.0, `disk = "fat-image"`), so it can write files; openkal-uefi implements `openkal.fs` over the firmware's
186190
file system and `openkal.random` over its RNG protocol, beneath openkal-musl
187191
0.29.8. okrun is a host for `macos-x86_64` (the release build of openkal-macos
188192
0.23.4 links) and `linux-i686` (built as `i686-linux-musl`), so `--systems all`
@@ -286,7 +290,7 @@ with `import std`:
286290

287291
```toml
288292
[target.x86_64-uefi]
289-
platform = "openkal-platform@0.29.0"
293+
platform = "openkal-platform@0.29.1"
290294
runner = { enabled = true }
291295
```
292296

@@ -321,7 +325,7 @@ run-time over openkal-dos, so it is written in C++23 with `import std`:
321325

322326
```toml
323327
[target.i686-dos-musl]
324-
platform = "openkal-platform@0.28.0"
328+
platform = "openkal-platform@0.29.1"
325329
```
326330

327331
The row is TECHNICAL EXPERIMENT ONLY (openkal-dos's README). A program is the
@@ -332,8 +336,8 @@ row's flags are its conventions: `-march=i486`, emulated thread-local storage
332336
(there is no thread register the toolchain can address), unwind tables for
333337
every unit, and the stack aligned to sixteen bytes at a call, as an i386 ok
334338
image's is (the row's code calls images and is called by them). The provider's
335-
link is `ld.lld -static --image-base=0x1000 -z norelro --gc-sections
336-
--eh-frame-hdr`, entered at `okdos_entry`, over `base = "none"`, and
339+
link is `ld.lld -static --image-base=0x1000 -z norelro -z stack-size=1048576
340+
--gc-sections --eh-frame-hdr`, entered at `okdos_entry`, over `base = "none"`, and
337341
the platform's tools it carries are the one its seal names (mcpp 2026.11.13.1):
338342
a DOS build builds `okdos` alone, and an ok image does not build it. `mcpp run`
339343
runs the program with dirun and xim's DOSBox Staging profile, which places
@@ -345,6 +349,13 @@ listed, resized and removed files and directories there (measured). openkal-dos
345349
provides `abort`, `env`, `exec`, `fs`, `memory`, `stream`, `terminal` and
346350
`time`. `region` is absent, because the DPMI host CWSDPMI is DPMI 0.90.
347351

352+
The stack (0.29.1) is the executable's statement: the row links with `-z
353+
stack-size=1048576`, and openkal-dos 0.1.1's stub reads PT_GNU_STACK's size and
354+
places the stack above a guard page (DPMI `0507h`), so an overflow is a reported
355+
page fault rather than a write over the program. A project states another size
356+
with its own link flags. Measured: 64 frames of 8 KiB return under DOSBox
357+
Staging.
358+
348359
## Version group
349360

350361
`[platform.versions]` names one version of each package of the family. From
@@ -380,7 +391,7 @@ previous patch's.
380391
| `checks/host-graph` | a build program runs as an ok image |
381392
| `checks/snapshot` | a C++ program starts from a snapshot of its initialisers, and a start whose named value differs does not |
382393
| `checks/i386` | an ok image of i386 is built in both modes, checked by okld and run by okrun built for i686-linux-musl; packed with `--systems dos-i686`, it runs as a DOS program |
383-
| `checks/dos` | a program of i686-dos-musl runs in both modes under DOSBox Staging (technical experiment only) |
394+
| `checks/dos` | a program of i686-dos-musl runs in both modes under DOSBox Staging, with a 512 KiB recursion, and states a 1 MiB stack (technical experiment only) |
384395
| family release | the group's members are tagged and mirrored, both mcpp releases resolve an image of it, and a patch removes no symbol |
385396

386397
## License

‎checks/dos/src/main.cpp‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
// A DOS program: its arguments sorted, an exception across a frame, the environment, a status.
1+
// A DOS program: its arguments sorted, an exception across a frame, the environment, a deep
2+
// stack, a status. The recursion uses 512 KiB (64 frames of 8 KiB): the row's stack is 1 MiB
3+
// (0.29.1, `-z stack-size'), which openkal-dos 0.1.1's stub reads from PT_GNU_STACK.
24
import std;
35

6+
int deep(int n) {
7+
volatile char frame[8192];
8+
frame[0] = static_cast<char>(n);
9+
return n == 0 ? frame[0] : deep(n - 1) + frame[0];
10+
}
11+
412
int main(int argc, char** argv) {
513
std::vector<std::string> v(argv + 1, argv + argc);
614
std::ranges::sort(v);
715
std::println("dos ok: {}", v);
816
try { throw std::runtime_error("across a frame"); }
917
catch (const std::exception& e) { std::println("caught: {}", e.what()); }
1018
std::println("PATH set: {}", std::getenv("PATH") != nullptr);
19+
std::println("deep: {}", deep(64));
1120
return 7;
1221
}

‎checks/uefi/src/main.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// The C++ a UEFI application is written in: the standard library's text, ranges and containers
22
// over openkal-musl and openkal-llvm-runtime, its arguments as the runner passed them (0.29.0: the
3-
// Shell's, an argument with a space whole), and its status returned to the machine that ran it.
3+
// Shell's, an argument with a space whole; 0.29.1: runs of blanks inside one kept), and its status
4+
// returned to the machine that ran it.
45
import std;
56

67
int main(int argc, char** argv) {

‎mcpp.toml‎

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[package]
1313
namespace = "mcpplibs"
1414
name = "openkal-platform"
15-
version = "0.29.0"
15+
version = "0.29.1"
1616
description = "The platform of ok images (<arch>-openkal): their toolchain, C library and C++ run-time, tools, compile and link conventions, seal, runner and carrier, as one versioned statement mcpp reads."
1717
license = "Apache-2.0"
1818
authors = ["mcpplibs"]
@@ -82,7 +82,7 @@ okld = "openkal-tools@0.6.4"
8282
okrun = "openkal-tools@0.6.4"
8383
okprof = "openkal-tools@0.6.4"
8484
# The seal of the DOS row (0.28.0): the stub of openkal-dos before an executable.
85-
okdos = "openkal-dos-tools@0.1.0"
85+
okdos = "openkal-dos-tools@0.1.1"
8686

8787
# Every unit of an image (SPEC 12.2):
8888
# -fPIC the image is ET_DYN and has no text relocation;
@@ -239,7 +239,7 @@ hosted = true
239239
base = "none"
240240
toolchain = "llvm@23.1.3"
241241
layers = { compiler-runtime = "openkal-llvm-runtime@0.20.3", "c++-abi" = "openkal-llvm-runtime@0.20.3", c-abi = { name = "openkal-musl", version = "0.29.8", default-features = false, features = ["posix", "malloc-mimalloc"] } }
242-
runner = { cmd = ["dirun", "--profile", "{pkg:freebsd-disk-image}/dirun.toml", "--emulator", "{pkg:qemu-x86}/bin/qemu-system-x86_64", "--", "{}"], host = "any", hosts = ["linux-x86_64"], requires = ["xim:dirun@0.5.0", "xim:freebsd-disk-image@14.5", "xim:qemu-x86@9.2.4-1"], enabled = false }
242+
runner = { cmd = ["dirun", "--profile", "{pkg:freebsd-disk-image}/dirun.toml", "--emulator", "{pkg:qemu-x86}/bin/qemu-system-x86_64", "--", "{}"], host = "any", hosts = ["linux-x86_64"], requires = ["xim:dirun@0.6.0", "xim:freebsd-disk-image@14.5-1", "xim:qemu-x86@9.2.4-1"], enabled = false }
243243

244244
[[platform.provider]]
245245
name = "freebsd-vm"
@@ -248,7 +248,7 @@ hosted = true
248248
base = "none"
249249
toolchain = "llvm@23.1.3"
250250
layers = { compiler-runtime = "openkal-llvm-runtime@0.20.3", "c++-abi" = "openkal-llvm-runtime@0.20.3", c-abi = { name = "openkal-musl", version = "0.29.8", default-features = false, features = ["posix", "malloc-mimalloc"] } }
251-
runner = { cmd = ["dirun", "--profile", "{pkg:aarch64-freebsd-disk-image}/dirun.toml", "--var", "firmware={pkg:ovmf}/share/edk2/edk2-aarch64-code.fd", "--emulator", "{pkg:qemu-system}/bin/qemu-system-aarch64", "--", "{}"], host = "any", hosts = ["linux-x86_64"], requires = ["xim:dirun@0.5.0", "xim:aarch64-freebsd-disk-image@14.5", "xim:ovmf@9.2.4-3", "xim:qemu-system@9.2.4"], enabled = false }
251+
runner = { cmd = ["dirun", "--profile", "{pkg:aarch64-freebsd-disk-image}/dirun.toml", "--var", "firmware={pkg:ovmf}/share/edk2/edk2-aarch64-code.fd", "--emulator", "{pkg:qemu-system}/bin/qemu-system-aarch64", "--", "{}"], host = "any", hosts = ["linux-x86_64"], requires = ["xim:dirun@0.6.0", "xim:aarch64-freebsd-disk-image@14.5-1", "xim:ovmf@9.2.4-4", "xim:qemu-system@9.2.4"], enabled = false }
252252

253253
[[platform.provider]]
254254
name = "wine"
@@ -293,7 +293,7 @@ hosted = true
293293

294294
layers = { compiler-runtime = "openkal-llvm-runtime@0.20.3", "c++-abi" = "openkal-llvm-runtime@0.20.3", c-abi = { name = "openkal-musl", version = "0.29.8", default-features = false, features = ["posix", "malloc-mimalloc"] } }
295295
link = { driver = "lld", start = "efi_main", flags = ["--subsystem", "efi_application", "--gc-sections"], exe = "{name}.efi", inputs = [{ file = "board/qemu-exit.S" }], seal = [] }
296-
runner = { cmd = ["dirun", "--payload", "{}", "--profile", "{pkg:ovmf}/dirun.toml", "--emulator", "{pkg:qemu-x86}/bin/qemu-system-x86_64", "--memory", "2048", "--"], hosts = ["linux-x86_64", "linux-aarch64", "macos-aarch64", "windows-x86_64"], requires = ["xim:dirun@0.5.0", "xim:qemu-x86@9.2.4-1", "xim:ovmf@9.2.4-3"], enabled = false }
296+
runner = { cmd = ["dirun", "--payload", "{}", "--profile", "{pkg:ovmf}/dirun.toml", "--emulator", "{pkg:qemu-x86}/bin/qemu-system-x86_64", "--memory", "2048", "--"], hosts = ["linux-x86_64", "linux-aarch64", "macos-aarch64", "windows-x86_64"], requires = ["xim:dirun@0.6.0", "xim:qemu-x86@9.2.4-1", "xim:ovmf@9.2.4-4"], enabled = false }
297297

298298
# DOS (0.28.0; TECHNICAL EXPERIMENT ONLY, openkal-dos's README): programs a DPMI
299299
# host runs, on the same C library and C++ run-time over openkal-dos
@@ -309,7 +309,10 @@ runner = { cmd = ["dirun", "--payload", "{}", "--profile", "{pkg:ovmf}/dirun.tom
309309
# them. The processor is the 486, as for the i386 ok image (DOSBox Staging 0.83
310310
# executes no CMPXCHG8B, measured). The runner is dirun with DOSBox Staging and CWSDPMI beside the program
311311
# (xim's `dosbox-staging'). The memory allocator is musl's own (`malloc-mallocng'):
312-
# it asks openkal.memory for blocks and nothing else.
312+
# it asks openkal.memory for blocks and nothing else. The stack (0.29.1) is the
313+
# executable's own statement, PT_GNU_STACK's size, which openkal-dos 0.1.1's stub
314+
# reads and places above a guard page: the row states 1 MiB (`-z stack-size'),
315+
# and a project's own link flags state another.
313316
[[platform.define]]
314317
triple = "i686-dos-musl"
315318
clang-triple = "i386-unknown-none-elf"
@@ -328,8 +331,8 @@ base = "none"
328331
hosted = true
329332

330333
layers = { compiler-runtime = "openkal-llvm-runtime@0.20.3", "c++-abi" = "openkal-llvm-runtime@0.20.3", c-abi = { name = "openkal-musl", version = "0.29.8", default-features = false, features = ["posix", "malloc-mallocng"] } }
331-
link = { driver = "lld", start = "okdos_entry", flags = ["-static", "--image-base=0x1000", "-z", "norelro", "--gc-sections", "--eh-frame-hdr"], seal = [["okdos", "seal", "{}"]] }
332-
runner = { cmd = ["dirun", "--payload", "{}", "--profile", "{pkg:dosbox-staging}/dirun.toml", "--"], hosts = ["linux-x86_64", "macos-aarch64", "windows-x86_64"], requires = ["xim:dirun@0.5.0", "xim:dosbox-staging@0.83.0-2"], enabled = false }
334+
link = { driver = "lld", start = "okdos_entry", flags = ["-static", "--image-base=0x1000", "-z", "norelro", "-z", "stack-size=1048576", "--gc-sections", "--eh-frame-hdr"], seal = [["okdos", "seal", "{}"]] }
335+
runner = { cmd = ["dirun", "--payload", "{}", "--profile", "{pkg:dosbox-staging}/dirun.toml", "--"], hosts = ["linux-x86_64", "macos-aarch64", "windows-x86_64"], requires = ["xim:dirun@0.6.0", "xim:dosbox-staging@0.83.0-2"], enabled = false }
333336

334337
# The family released together for openkal 0.17 (the 0.17.2 round: okb, the
335338
# runner's bundle and library interfaces, musl's renameat2; the 0.17.3 round:
@@ -390,7 +393,9 @@ runner = { cmd = ["dirun", "--payload", "{}", "--profile", "{pkg:dosbox-staging}
390393
# 0.29.7 (`uname' names the system a hosted program runs on); 0.29.0, openkal-uefi
391394
# 0.11.0 (openkal.fs over the firmware's file system, openkal.random over its RNG
392395
# protocol, the Shell's arguments) beneath openkal-musl 0.29.8, which admits it:
393-
# one version of each in a build. From 0.24.1 the members name one another by
396+
# one version of each in a build; 0.29.1, openkal-uefi 0.11.1 (the Shell's arguments
397+
# divided from the load options, so whitespace inside a quoted one arrives whole)
398+
# and openkal-dos 0.1.1 (the stack from PT_GNU_STACK above a guard page). From 0.24.1 the members name one another by
394399
# compatible ranges (`^0.28.0`) and this group chooses the versions: mcpp
395400
# 2026.11.7.1 resolves within it, and a fix of one member is that member's
396401
# release and a patch of this group, released together through one index change
@@ -401,9 +406,9 @@ openkal-linux = "0.26.3"
401406
openkal-macos = "0.23.4"
402407
openkal-windows = "0.21.2"
403408
openkal-freebsd = "0.1.2"
404-
openkal-uefi = "0.11.0"
405-
openkal-dos = "0.1.0"
406-
openkal-dos-tools = "0.1.0"
409+
openkal-uefi = "0.11.1"
410+
openkal-dos = "0.1.1"
411+
openkal-dos-tools = "0.1.1"
407412
openkal-musl = "0.29.8"
408413
openkal-llvm-runtime = "0.20.3"
409414
openkal-ld = "0.6.4"
@@ -416,4 +421,4 @@ openkal-tools = "0.6.4"
416421
openkal-tools = { version = "0.6.4", tools = ["okld"] }
417422

418423
[build-dependencies.mcpp]
419-
plugins = { version = "0.20.0", features = ["plugins-platform"], host-module = true }
424+
plugins = { version = "0.22.1", features = ["plugins-platform"], host-module = true }

0 commit comments

Comments
 (0)