Skip to content

openkal-dos 0.1.0: openkal on DOS through DPMI, the stub, okdos and fault reporting (technical experiment only) - #1

Open
Sunrisepeak wants to merge 5 commits into
mainfrom
feat/0.1.0
Open

Sunrisepeak wants to merge 5 commits into
mainfrom
feat/0.1.0

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

openkal-dos 0.1.0 is an implementation of openkal on DOS, through a DPMI host. It is a technical experiment only and carries no stability guarantee.

Contents

  • Stub (stub/stub.S, 2544 bytes). An MZ program in 16-bit code. It finds a 32-bit DPMI host and otherwise runs CWSDPMI.EXE from the program's directory. It enters protected mode as a 32-bit client, loads the ELF32 i386 executable (ET_EXEC, base 0x1000) into one block and hands over a record (src/dos.h, version 1).
  • Interfaces.
    • openkal.fs (files).
    • openkal.terminal (the console).
    • openkal.exec (executable memory).
    • The environment, time, memory, stream and abort.
    • openkal.region is absent, as measured.
  • Faults. A processor fault (#DE, #UD, #SS, #GP, #PF) is reported on standard error, through DPMI 0203h handlers. The program ends with 128 plus the signal's number: 136, 132 or 139. Without the handlers, CWSDPMI prints a register dump on the screen and ends with status 1.
  • okdos (package openkal-dos-tools). okdos seal writes the stub before an executable; okdos check reports whether a file is such a program.
  • Conventions. The target is a 486: -march=i486. DOSBox Staging 0.83 executes no CMPXCHG8B under any cputype.

CI

  • stub: build.sh reproduces the committed stub byte for byte.
  • okdos: built and refusing a plain file on Linux, macOS and Windows.
  • programs: examples/hello in dev and release returns 7, tests/files returns 9 and tests/fault returns 139, under DOSBox Staging through dirun.

The programs job builds through openkal-platform 0.28.0 (row i686-dos-musl). It passes once that release and mcpp 2026.11.13.1 are published.

Verified locally

Using the platform at a local path, the programs return 7 (dev), 7 (release), 9 (files) and 139 (fault). The stub is reproducible.

CWSDPMI is distributed under its own terms; it is fetched by the runner's package and not carried here.

…n ELF32 executable, and okdos (technical experiment only)
… and executable memory (openkal.exec); regions absent, measured
… the signal's number

DPMI's exception handlers (int 31h, 0203h) for #DE, #UD, #SS, #GP and #PF record the vector, the error code and the faulting EIP, and resume the program on a stack of its own, where the report names the fault and its address and the program ends with 136, 132 or 139. CWSDPMI's own report is a register dump on the screen and status 1, which a program's output and status do not distinguish from exit(1) (measured). The README states the 486 the row is compiled for (DOSBox Staging executes no CMPXCHG8B, measured) and an i386 ok image run on DOS by the core runner carried as a program of the row.
…DOSBox Staging; tests/fault

The programs job builds the examples and tests/fault for i686-dos-musl with this repository's openkal-dos and runs them with dirun and DOSBox Staging: hello unoptimised and optimised (status 7), files (9), a page fault (139). Measured locally against the platform's working tree: 7, 7, 9 and 139.
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