Skip to content

OXOS v0.1.4

Choose a tag to compare

@kooscode kooscode released this 17 Oct 21:07
· 53 commits to main since this release

Memory release: games now get at least as much memory as with the original kernel. The memory manager and file cache were rewritten to match how the original kernel works.

Download: bios_v0.1.4.bin (1 MB, SHA-256 220ad9eb5e9463da4ab0ea419427c77072a1ebde57e7c120c1d052317fe6f062)

Why the rewrite

Some games had memory-related trouble, so we measured instead of guessing:

  • Measured at game start: with the original BIOS and with ours, xemu was stopped at the instant each game starts, and the free memory was counted.
    • Games: the dashboard, Halo, Halo 2 and Half-Life 2.
    • Every one had about 1.2 MB (305 pages) less with our kernel.
  • Measured during play: a few minutes of real gameplay in each, recorded every 10 seconds. These games run very close to the limit:
    • Halo 2 keeps under 1 MB free.
    • Half-Life 2 dropped to about 150 KB.
    • A 1.2 MB shortfall is enough to break them.
  • Re-examined the original kernel's memory manager and file cache, looking at how it tracks memory, which pages it hands out, and what it keeps for itself.
  • Rewrote the specs from that (spec 09 memory manager, spec 16 file cache), then the implementation to match. Each step was checked against the measurements.

What changed

  • The boot splash no longer holds memory when the game starts. It stays on screen but its memory is handed to the game, as the original kernel does with its boot animation. This alone was 1.2 MB.
  • Memory bookkeeping works like the original's. Free memory is tracked inside the page tables, as the original does, with no extra tables of its own.
  • Memory is handed out in the original's order. If a game asks for a fixed memory area the kernel is already using, the kernel moves its own data out of the way.
  • The kernel's own memory matches the original's: the same size, the same number of thread stacks, and no extra threads.
  • One file cache shared by the hard disk and DVD file systems, sized and counted like the original's: 16 pages at boot, and whatever a game or the dashboard asks for. Before, DVD directory lookups and small reads went to the drive every time.
  • Memory statistics report what the original reports (game image, cache, pool and stack memory), and the debugger memory table points at structures in the original's format.

Measured result (free memory when the game starts)

Game Original kernel v0.1.3 v0.1.4
Dashboard 15,876 pages 15,560 15,881
Halo 15,347 15,042 15,350
Halo 2 14,880 14,575 14,883
Half-Life 2 16,166 15,861 16,169

During gameplay, memory use by type (game, graphics, pool, cache) now matches the original kernel within a few pages in all four.

Checked in xemu

  • All make test phases pass, including a new test that moving memory in use keeps its contents.
  • The dashboard, Halo, Halo 2 and Half-Life 2 played for several minutes each.

Using it in xemu

  1. Open Machine → Settings → System.
  2. Set Flash (BIOS) File to bios_v0.1.4.bin and leave MCPX Boot ROM File empty.

Known limitations

  • Not tested on a real console yet.
  • The power, eject and AV-cable events moved to a new code path. They pass the tests, but haven't been triggered by hand from xemu's menu yet.
  • No TV-encoder tables.
  • No certificate key: stock saves and System Link with stock consoles won't work.

Sources (GPL-2.0)

  • This repository at tag v0.1.4.
  • XboxDev/cromwell at 86f547387184d1001d377cce97d3756c8acf91cc for the X-codes and EEPROM key states.
  • Contains no Microsoft code. Not affiliated with or endorsed by Microsoft.